Class: Amaze::Grid::Sigma
- Inherits:
-
Amaze::Grid
- Object
- Amaze::Grid
- Amaze::Grid::Sigma
- Defined in:
- lib/amaze/grid/sigma.rb
Instance Attribute Summary
Attributes inherited from Amaze::Grid
Instance Method Summary collapse
Methods inherited from Amaze::Grid
#[], #deadends, #each_cell, #each_row, #initialize, #random_cell, #size
Constructor Details
This class inherits a constructor from Amaze::Grid
Instance Method Details
#configure_cell ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/amaze/grid/sigma.rb', line 12 def configure_cell each_cell do |cell| row, column = cell.row, cell.column cell.north = self[row-1, column] cell.south = self[row+1, column] if column.even? cell.northeast = self[row-1, column+1] cell.southeast = self[row,column+1] cell.northwest = self[row-1, column-1] cell.southwest = self[row, column-1] else cell.northeast = self[row, column+1] cell.southeast = self[row+1,column+1] cell.northwest = self[row, column-1] cell.southwest = self[row+1, column-1] end end end |