Amazing [pun not intended, sorry] that something coherent can be generated through such absurdly simple, random code...
Originally shared by Norbert Landsteiner
I Declare Maze Day
Many amazing maze programs have been written for computers of all bread and kind, but, for some reason, there's no international Maze Day (while a few educational institutions in the US do have one of their own).
Here's one example, a quite famous BASIC one-liner for Commodore 8-bit computers generating a maze from just two characters ("\" and "/"):
10 PRINT CHR$(205.5+RND(1));: GOTO 10
Try it online: http://www.masswerk.at/pet/?run=maze
What may be a suitable date for Maze Day?
Do you remember any maze algorithms in particular?
Python:
ReplyDeleteimport random, sys
while True: sys.stdout.write(random.choice(u"╱╲"))
Python3:
import random
while True: print(random.choice(u"╱╲"), end='')
Other characters that work well
fileformat.info - Unicode Characters in the Box Drawing Block
The code doesn't guarantee a solution path through the maze.
ReplyDeleteThat's debatable. Generate a large enough maze and select a small enough area and you'll definitely have something with a navigable route. What it doesn't do is guarantee a solution within a fixed area.
ReplyDeletehttps://lh3.googleusercontent.com/OOocaQB0CvT6AHenEQJBFZcQdAh048RUtnTnDWBPKlbk2e07uUKiDuqPUJH_6e6bsotH_xxScnRlkv9E1DzHSoSFjqO0MQzwOqQi=s0
ReplyDeleteI thought that font looked familiar...
ReplyDeleteI guess that depends on what one takes the entrance and exit definition to be. Left to right edges?
ReplyDelete