Class: XO::AI::MinGameState
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
104 105 106 |
# File 'lib/xo/ai/minimax.rb', line 104 def next_game_state(next_grid, other_player, move) MaxGameState.new(next_grid, other_player, move) end |
#non_terminal_score ⇒ Object
119 120 121 |
# File 'lib/xo/ai/minimax.rb', line 119 def non_terminal_score scores.min end |
#terminal_score ⇒ Object
108 109 110 111 112 113 114 115 116 117 |
# File 'lib/xo/ai/minimax.rb', line 108 def terminal_score case result[:type] when :winner -1 when :loser 1 when :squashed 0 end end |