Class: Maze::Orthogonal
Constant Summary collapse
Constants inherited from Generic
Generic::E, Generic::N, Generic::NE, Generic::NW, Generic::S, Generic::SE, Generic::SW, Generic::W
Instance Attribute Summary
Attributes inherited from Generic
#algorithm, #grid, #height, #width
Instance Method Summary collapse
- #calculate_offset_x_axis(*args) ⇒ Object
- #calculate_offset_y_axis(*args) ⇒ Object
- #opposite(direction) ⇒ Object
- #random_directions ⇒ Object (also: #directions)
Methods inherited from Generic
#[], #[]=, #connect, #connected?, #draw, #generate, #initialize, #tessellation
Constructor Details
This class inherits a constructor from Maze::Generic
Instance Method Details
#calculate_offset_x_axis(*args) ⇒ Object
18 19 20 21 |
# File 'lib/maze/orthogonal.rb', line 18 def calculate_offset_x_axis(*args) distance_x = { N => 0, S => 0, E => 1, W => -1 } distance_x[args.first] end |
#calculate_offset_y_axis(*args) ⇒ Object
23 24 25 26 |
# File 'lib/maze/orthogonal.rb', line 23 def calculate_offset_y_axis(*args) distance_y = { N => -1, S => 1, E => 0, W => 0 } distance_y[args.first] end |
#opposite(direction) ⇒ Object
14 15 16 |
# File 'lib/maze/orthogonal.rb', line 14 def opposite(direction) OPPOSITE[direction] end |