Class: XO::AI::MaxGameState
Instance Attribute Summary
Attributes inherited from GameState
#grid, #move, #next_states, #player
Instance Method Summary collapse
- #next_game_state(next_grid, other_player, move) ⇒ Object
- #non_terminal_score ⇒ Object
- #terminal_score ⇒ Object
Methods inherited from GameState
#initialize, #is_terminal?, #result, #score, #scores
Constructor Details
This class inherits a constructor from XO::AI::GameState
Instance Method Details
#next_game_state(next_grid, other_player, move) ⇒ Object
82 83 84 |
# File 'lib/xo/ai/minimax.rb', line 82 def next_game_state(next_grid, other_player, move) MinGameState.new(next_grid, other_player, move) end |
#non_terminal_score ⇒ Object
97 98 99 |
# File 'lib/xo/ai/minimax.rb', line 97 def non_terminal_score scores.max end |
#terminal_score ⇒ Object
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/xo/ai/minimax.rb', line 86 def terminal_score case result[:type] when :winner 1 when :loser -1 when :squashed 0 end end |