Imagine a very simple game, where in any non-final position, the active player can make either move 1 or move 2.
Let's say if player 1 starts with move 1, he wins the game immediately. If he starts with move 2, he can still win if player 2 plays move 1, but loses if player 2 plays move 2.
value([1]) := win for player 1
value([2,1]) := win for player 1
value([2,2]) := win for player 2
Obviously, move 1 is the best move to make. Not only because it wins the game immediately, but also because player 1 isn't guaranteed a win if plays move 2 instead.
For any lookahead depth greater than 1, GKMinmaxStrategist
wants to play move 2 though. Note that the strategist doesn't even seem to explore the possibility of player 1 losing the game, only the positions [1]
and [2,1]
are explored. It seems to me that GKMinmaxStrategist
is pruning too many positions.
Am I missing something here?
You can find the sample project on GitHub.