logoalt Hacker News

fjfaasetoday at 12:43 AM3 repliesview on HN

Are there also algorithms for (incremental) generation of infinite mazes?


Replies

tromptoday at 8:23 AM

The linked-to page mentions:

> Infinite length Mazes: It's possible to create an infinitely long Maze (a finite number of columns by as many rows as you like) by only keeping part of the Maze in memory at a time and "scrolling" from one end to the other, discarding earlier rows while creating later rows.

> An easier way to make an infinite Maze is with Eller's or the Sidewinder algorithms, as they already make Mazes one row at time, so simply keep letting them add rows to the Maze forever.

My tiny obfuscated maze program at https://tromp.github.io/pearls.html#maze will print an infinitely long maze if you enter a negative height.

fc417fc802today at 2:19 AM

What would it mean for a maze to be infinite? It seems to me that a key part of the concept is having a goal to reach.

Although I guess you could have an infinitely large map and an algorithm that guaranteed connectivity. Infinite ways to fail to reach the goal. But I doubt there would be much practical benefit.

To actually answer your question it should be fairly easy to convert nearly any existing algorithm to cover an infinite area by simply tiling it. A common method to avoid boundary issues is to overlap the tiles slightly.

show 2 replies
contravarianttoday at 8:32 AM

I'd probably go with something like the wave function collapse algorithm. It should be possible to make it generate trees with somewhat uniform probability.