class Theseus::SigmaMaze

A “sigma” maze is one in which the field is tesselated into hexagons. Trying to map such a field onto a two-dimensional grid is a little tricky; Theseus does so by treating a single row as the hexagon in the first column, then the hexagon below and to the right, then the next hexagon above and to the right (on a line with the first hexagon), and so forth. For example, the following grid consists of two rows of 8 cells each:

 _   _   _   _
/ \_/ \_/ \_/ \_
\_/ \_/ \_/ \_/ \ 
/ \_/ \_/ \_/ \_/ 
\_/ \_/ \_/ \_/ \ 
  \_/ \_/ \_/ \_/

SigmaMaze supports weaving, but not symmetry (yet).

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

Constants

AXIS_MAP

This maps which axis the directions share, depending on whether a cell is shifted (true) or not (false). For example, in a non-shifted cell, E is on a line with NW, so AXIS_MAP[E] returns NW (and vice versa). This is used in the weaving algorithms to determine which direction an UNDER passage moves as it passes under a cell.