Class: Cell
- Inherits:
-
Object
- Object
- Cell
- Defined in:
- lib/connect_four.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
-
#search_paths ⇒ Object
readonly
Returns the value of attribute search_paths.
-
#state ⇒ Object
(e.g. empty, player1, player2).
Instance Method Summary collapse
- #add_search_path(path) ⇒ Object
-
#initialize(args) ⇒ Cell
constructor
A new instance of Cell.
Constructor Details
#initialize(args) ⇒ Cell
Returns a new instance of Cell.
8 9 10 11 12 13 |
# File 'lib/connect_four.rb', line 8 def initialize(args) @state = " " #available to have a move made in it. @row = args[:row] #set at initialization @column = args[:column] #set at initialization @search_paths = [] #will become set based on position on the board. end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
7 8 9 |
# File 'lib/connect_four.rb', line 7 def column @column end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
7 8 9 |
# File 'lib/connect_four.rb', line 7 def row @row end |
#search_paths ⇒ Object (readonly)
Returns the value of attribute search_paths.
7 8 9 |
# File 'lib/connect_four.rb', line 7 def search_paths @search_paths end |
#state ⇒ Object
(e.g. empty, player1, player2)
6 7 8 |
# File 'lib/connect_four.rb', line 6 def state @state end |
Instance Method Details
#add_search_path(path) ⇒ Object
15 16 17 |
# File 'lib/connect_four.rb', line 15 def add_search_path(path) @search_paths << path end |