Re:Practical algorithms and code optimization: maze generation
by sandyfajita on Monday March 25, 2013 @03:37AM
(#5435877)
One can also use a disjoint-set data structure. Make a list of walls as tuples containing the "room number" (cell index) of both adjacent cells. Add all cells as disjoint sets in a disjoint-set data structure. Shuffle all the doors (tuples) randomly. Then go through the shuffled list and for each door: IF both sides are not part of the same set already: remove the wall. ELSE save the wall, it is part of the final maze.
[ Parent
| on HN ]
There are no comments on this comment yet.