Class: RubyTictactoe::Player
- Inherits:
-
Object
- Object
- RubyTictactoe::Player
- Defined in:
- lib/player.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#marker ⇒ Object
Returns the value of attribute marker.
-
#opponent ⇒ Object
Returns the value of attribute opponent.
Instance Method Summary collapse
- #add_marker(board, cell) ⇒ Object
-
#initialize(marker) ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize(marker) ⇒ Player
Returns a new instance of Player.
5 6 7 8 |
# File 'lib/player.rb', line 5 def initialize(marker) @marker = marker @opponent = nil end |
Instance Attribute Details
#marker ⇒ Object
Returns the value of attribute marker.
4 5 6 |
# File 'lib/player.rb', line 4 def marker @marker end |
#opponent ⇒ Object
Returns the value of attribute opponent.
4 5 6 |
# File 'lib/player.rb', line 4 def opponent @opponent end |
Instance Method Details
#add_marker(board, cell) ⇒ Object
10 11 12 |
# File 'lib/player.rb', line 10 def add_marker(board, cell) board.all_cells[cell] = self.marker end |