Implementing a Third Dimension
Explore the process of adding a third dimension to maze grids by expanding two-dimensional arrays into three-dimensional structures. Learn how the Cell3D and Grid3D classes are implemented to handle up and down neighbors, enabling most algorithms to work seamlessly in 3D mazes. Understand the key modifications needed for creating and iterating through stacked maze levels.
We'll cover the following...
Introduction
When we first worked on the code behind the grid, we implemented the prepare_grid method using a two-dimensional array. That’s not just coincidence—that’s exactly what determined the geometry of our grid! We’ll add a third dimension to the grid by adding a third dimension to that array.
However, it's not that easy. The good news, though, is that the other changes are minor related to that array modification. The cells need to be told about their new up/down ...