What steps will reproduce the problem?
1. Run the following
from games import *
ttt = TicTacToe(3,3,3)
play_game(ttt,alphabeta_player,alphabeta_player)
2. Note that X always win, and that O seems to help X to win
What is the expected output? What do you see instead?
Expected is that there will always be a draw.
What version of the product are you using? On what operating system?
Ubuntu 10.10
Here is a patch to solve the problem.
Check which player is making the move and negate the utility when the player is
O.
class TicTacToe(Game):
...
def utility(self, state, player):
"Return the value to X; 1 for win, -1 for loss, 0 otherwise."
if player=="O":
return -state.utility
else:
return state.utility
Original issue reported on code.google.com by daniel.u...@gmail.com on 28 Feb 2011 at 6:55
Original issue reported on code.google.com by
daniel.u...@gmail.com
on 28 Feb 2011 at 6:55