Class: AI
- Inherits:
-
Object
- Object
- AI
- Defined in:
- lib/ttt-cli/ai.rb
Instance Attribute Summary collapse
-
#best_move ⇒ Object
Returns the value of attribute best_move.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(game, computer) ⇒ AI
constructor
A new instance of AI.
-
#move_generate ⇒ Object
Метод для генерации хода AI.
Constructor Details
#initialize(game, computer) ⇒ AI
Returns a new instance of AI.
10 11 12 13 14 15 16 |
# File 'lib/ttt-cli/ai.rb', line 10 def initialize(game, computer) @game = game @board = game.board @computer = computer @enemy = @game.first_player @best_move = nil end |
Instance Attribute Details
#best_move ⇒ Object
Returns the value of attribute best_move.
4 5 6 |
# File 'lib/ttt-cli/ai.rb', line 4 def best_move @best_move end |
Class Method Details
.create(game, type, computer) ⇒ Object
6 7 8 |
# File 'lib/ttt-cli/ai.rb', line 6 def self.create(game, type, computer) type.new(game, computer) end |
Instance Method Details
#move_generate ⇒ Object
Метод для генерации хода AI
19 |
# File 'lib/ttt-cli/ai.rb', line 19 def move_generate; end |