Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This code displays forward slash and backslash randomly over the entire screen. This may look a bit like a maze, but it is not. Title should read "How to display random garbage to the screen as slashes in 13 bytes". Still impressed?


You were modded down, but I tend to agree. Randomly printing slash characters is not a valid way to generate anything that could be called a "maze," and it's consequently not a very interesting thing to optimize.

I suppose that if you fed it with a source of true randomness and let it run long enough, the output would eventually contain all possible mazes with unit corridor width. It may be more precise to say it can't generate a labyrinth, or a dungeon with rooms.


What constitutes a maze? Enforced solvability?


Forming a spanning tree; or equivalently, having a unique path between any two cells. Sometimes a few additional connections (adding cycles to the spanning tree) are considered ok.


Really, multiply connected mazes are more interesting and more aesthetically pleasing.

A question, though. If, in 2D, having all walls in one piece is simply connected, and having some islands is multiply connected, what are the possible types of 3D maze (let's call it a cave). You can obviously have simply connected walls, or multiply connected walls (floating shells of rock) but what name would you give the type that has some looping paths but no floating rocks? Do we talk about genus?


Mike Bostock's visualizations of maze-creation algorithms (via spanning tree) are absolutely beautiful:

http://bost.ocks.org/mike/algorithms/#maze-generation




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: