Implementing Eller's Algorithm
Explore the implementation of Eller's algorithm to generate mazes one row at a time using a row-centric state object. Understand managing cell sets, linking adjacent cells, carving paths south, and merging sets. Learn to compare Eller's results with other maze algorithms like Sidewinder to solidify your grasp of maze generation techniques.
The Ellers class
Eller’s algorithm works strictly one row at a time, so our implementation will take advantage of that by leaning on a row-centric state object. Once we have that state object, the rest of the algorithm comes together quickly. We’ll start with the RowState class, which we’ll place under the namespace of the Ellers class. So, let’s first create the RowState class.
The RowState class
Code explanation
Lines 2–6: The initialize method has a starting_set parameter (defaulting to 0), which ...