Implementing the WeaveGrid Class
Explore the implementation of the WeaveGrid class that manages two cell types to build woven mazes. Understand how to handle under-cells, customize maze rendering with insets, and integrate this class into existing maze programs to generate complex braided maze structures.
The WeaveGrid class
Let's implement our WeaveGrid class, which manages the two different cell types highlighted below.
Code explanation
Line 6: The constructor doesn’t add much, just initializing a new array, @under_cells, that will be used to hold the under-cells that get created.
Line 18: Here, the creation of those cells is managed by the tunnel_under method.
Line 26: We also need to make sure that our each_cell method doesn’t ignore under-cells. It needs to report every ...