Class: ComputerPlayer
- Defined in:
- lib/ang_ttt_gem/computer_player.rb
Instance Attribute Summary collapse
-
#ai ⇒ Object
Returns the value of attribute ai.
Instance Method Summary collapse
- #get_move(board) ⇒ Object
-
#initialize(mark) ⇒ ComputerPlayer
constructor
A new instance of ComputerPlayer.
Methods inherited from Player
Constructor Details
#initialize(mark) ⇒ ComputerPlayer
Returns a new instance of ComputerPlayer.
9 10 11 |
# File 'lib/ang_ttt_gem/computer_player.rb', line 9 def initialize(mark) self.set_mark(mark) end |
Instance Attribute Details
#ai ⇒ Object
Returns the value of attribute ai.
7 8 9 |
# File 'lib/ang_ttt_gem/computer_player.rb', line 7 def ai @ai end |
Instance Method Details
#get_move(board) ⇒ Object
13 14 15 16 |
# File 'lib/ang_ttt_gem/computer_player.rb', line 13 def get_move(board) ai = Ai.new(self, board) cell_number = ai.find_best_move end |