|
|
|
|
|
by sandyfajita
4832 days ago
|
|
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. |
|