There are all kinds of maze generating algorithms out there. This one of mine uses a pretty simple premise.
 Choose a random spot on the map
 If not first time, must be connected to existing corridor
 Choose a random direction to go (up, down, left, right)
 Is it "free" there ?
 Yes, cut a line from original to this place.
 No ? Try a different direction ?
 No directions are good ? We are completely stuck ? Exit here and GOTO 
 Line was cut, if not complete with maze, GOTO 
 Completed maze ? Mark entrance and exit and loop forever.
Written in only a little over 200-tokens, this is compact maze making code indeed. Oh, and if you check it carefully, you will see that it guarantees only ONE way through. No way to reach the exit from two-different paths at all.
Press CTRL-R to make a new different maze each time.
Source code gives option to show maze being carefully drawn.
[Please log in to post a comment]