Class: Player
- Inherits:
-
Object
- Object
- Player
- Defined in:
- lib/connect_four.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#moves ⇒ Object
Returns the value of attribute moves.
-
#name ⇒ Object
Returns the value of attribute name.
-
#symbol ⇒ Object
Returns the value of attribute symbol.
Instance Method Summary collapse
-
#add_move(cell) ⇒ Object
adds a cell object to player’s moves array.
-
#initialize ⇒ Player
constructor
read the moves.
Constructor Details
#initialize ⇒ Player
read the moves.
261 262 263 264 265 |
# File 'lib/connect_four.rb', line 261 def initialize @symbol = nil @name = nil @moves = [] end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
257 258 259 |
# File 'lib/connect_four.rb', line 257 def color @color end |
#moves ⇒ Object
Returns the value of attribute moves.
257 258 259 |
# File 'lib/connect_four.rb', line 257 def moves @moves end |
#name ⇒ Object
Returns the value of attribute name.
257 258 259 |
# File 'lib/connect_four.rb', line 257 def name @name end |
#symbol ⇒ Object
Returns the value of attribute symbol.
257 258 259 |
# File 'lib/connect_four.rb', line 257 def symbol @symbol end |
Instance Method Details
#add_move(cell) ⇒ Object
adds a cell object to player’s moves array
267 268 269 |
# File 'lib/connect_four.rb', line 267 def add_move(cell) #adds a cell object to player's moves array @moves << cell end |