Making Triangle (Delta) Mazes

Just as hexagon grids produce sigma mazes, so triangle grids produce delta mazes. (This one at least makes a little sense, since the Greek letter delta, Δ, is shaped like a triangle.) Again, though, it makes little difference what you call it, because in the end it’s just another scaffolding for making mazes!

Let’s copy our hex_maze.rb file to delta_maze.rb and change it to refer to our new triangle grid:

delta_maze.rb
 
require ​'recursive_backtracker'
*
require ​'triangle_grid'
 
*
grid = TriangleGrid.new(10, 17)
 
RecursiveBacktracker.on(grid)
 
*
grid.to_png.save(​'delta.png'​)

The dimensions for the grid were empirically chosen to produce a roughly square canvas. Aside from that, it’s just the same old deal—instantiating ...

Get Mazes for Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.