Class: AIGames::FourInARow::Cell
- Inherits:
-
Object
- Object
- AIGames::FourInARow::Cell
- Defined in:
- lib/ai_games/four_in_a_row/cell.rb
Overview
The playing field consists of cells. Each cell is located in a certain row and column, and can belong to one of the players.
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
The column the cell is in.
-
#owner ⇒ Object
The bot who fills this cell.
-
#row ⇒ Object
readonly
The row the cell is in.
Instance Method Summary collapse
-
#initialize(row, column, owner = nil) ⇒ Cell
constructor
Initializes the cell with the given position, and optionally the owner.
Constructor Details
#initialize(row, column, owner = nil) ⇒ Cell
Initializes the cell with the given position, and optionally the owner.
35 36 37 38 39 |
# File 'lib/ai_games/four_in_a_row/cell.rb', line 35 def initialize(row, column, owner = nil) @row = row @column = column @owner = owner end |
Instance Attribute Details
#column ⇒ Object (readonly)
The column the cell is in
29 30 31 |
# File 'lib/ai_games/four_in_a_row/cell.rb', line 29 def column @column end |
#owner ⇒ Object
The bot who fills this cell
32 33 34 |
# File 'lib/ai_games/four_in_a_row/cell.rb', line 32 def owner @owner end |
#row ⇒ Object (readonly)
The row the cell is in
26 27 28 |
# File 'lib/ai_games/four_in_a_row/cell.rb', line 26 def row @row end |