July 2015
Intermediate to advanced
286 pages
6h 31m
English
To implement this improved polar grid, we’re going to introduce a new Cell subclass, and then walk through how these new cells will be laid out and subdivided. We’ll finish it all off with one last mostly cosmetic tweak to make our final maze as tidy as possible.
First, the new Cell subclass. We’ve made do so far with using the existing Cell class, but it’s getting a bit unwieldy to keep referring to compass directions when they don’t map very intuitively to a polar grid. Also, with adaptive subdivision, some cells may now have two neighbors in the outward direction, and our existing Cell class has no support for that.
So, put the following in polar_cell.rb.
| polar_cell.rb | |
| Line 1 | require 'cell' |