class Theseus::DeltaMaze

A “delta” maze is one in which the field is tesselated into triangles. Thus, each cell has three potential exits: east, west, and either north or south (depending on the orientation of the cell).

   __  __  __
 /\  /\  /\  /
/__\/__\/__\/
\  /\  /\  /\ 
 \/__\/__\/__\ 
 /\  /\  /\  /
/__\/__\/__\/
\  /\  /\  /\ 
 \/__\/__\/__\

Delta mazes in Theseus do not support either weaving, or symmetry.

maze = Theseus::DeltaMaze.generate(width: 10)
puts maze

Public Instance Methods

points_up?(x, y) click to toggle source

Returns true if the cell at (x,y) is oriented so the vertex is “up”, or north. Cells for which this returns true may have exits on the south border, and cells for which it returns false may have exits on the north.

# File lib/theseus/delta_maze.rb, line 32
def points_up?(x, y)
  (x + y) % 2 == height % 2
end