Class: HardAI

Inherits:
AI
  • Object
show all
Defined in:
lib/ttt-cli/strategies/hard_ai.rb

Instance Attribute Summary

Attributes inherited from AI

#best_move

Instance Method Summary collapse

Methods inherited from AI

create, #initialize

Constructor Details

This class inherits a constructor from AI

Instance Method Details

#move_generateObject



4
5
6
7
8
9
10
11
# File 'lib/ttt-cli/strategies/hard_ai.rb', line 4

def move_generate
  if is_first_move?
    @board.even_cells.sample
  else
    minimax(@board, @computer)
    @best_move
  end
end