Class: AIGames::FourInARow::Cell

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#columnObject (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

#ownerObject

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

#rowObject (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