im no expert so im not 100% these are errors
def play_game(game, *players):
"Play an n-person, move-alternating game."
state = game.initial
while True:
for player in players:
move = player(game, state)
state = game.make_move(move, state)
if game.terminal_test(state):
return game.utility(state, players[0]) *******this
line
and (within class TicTacToe)
def utility(self, state): *********** i this changed to (self,
state, player)
"Return the value to X; 1 for win, -1 for loss, 0 otherwise."
return state.utility
dont know if that is considered trivial, but i certainly expected
t = TicTacToe()
first = random_player
sec = random_player
play_game(t, first, sec)
to work out of the box
as i say, im far from expert and dont have the book (yet)
also, if i do
t = TicTacToe()
first = random_player
sec = alphabeta_player
play_game(t, first, sec)
sec wins less than i think he should
>> Stay informed about: mistake in AIAMA python code