Class: Player
- Inherits:
-
Object
- Object
- Player
- Defined in:
- lib/player.rb
Direct Known Subclasses
AIPlayer, ComputerPlayer, HumanPlayer, MaximizingPlayer, MinimizingPlayer
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
- #get_alpha(alpha, score) ⇒ Object
- #get_beta(beta, score) ⇒ Object
-
#initialize(marker) ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize(marker) ⇒ Player
Returns a new instance of Player.
3 4 5 6 |
# File 'lib/player.rb', line 3 def initialize(marker) @marker = marker @opponent = nil end |
Instance Attribute Details
#marker ⇒ Object
Returns the value of attribute marker.
2 3 4 |
# File 'lib/player.rb', line 2 def marker @marker end |
#opponent ⇒ Object
Returns the value of attribute opponent.
2 3 4 |
# File 'lib/player.rb', line 2 def opponent @opponent end |
Instance Method Details
#add_marker(board, cell) ⇒ Object
8 9 10 |
# File 'lib/player.rb', line 8 def add_marker(board, cell) board.all_cells[cell] = self.marker end |
#get_alpha(alpha, score) ⇒ Object
12 13 14 |
# File 'lib/player.rb', line 12 def get_alpha(alpha, score) alpha end |
#get_beta(beta, score) ⇒ Object
16 17 18 |
# File 'lib/player.rb', line 16 def get_beta(beta, score) beta end |