You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly it does not have a player argument so none of the search algorithms
work on it.
def utility(self, state, player):
"Return the value to X; 1 for win, -1 for loss, 0 otherwise."
if player == 'X':
return state.utility
if player == 'O':
return -state.utility
Does seem to work.
Tom Hall
Original issue reported on code.google.com by tom.h...@forward.co.uk on 11 Aug 2011 at 6:55
The text was updated successfully, but these errors were encountered:
ttt = TicTacToe()
state = ttt.initial
for move in [(2,1),(1,1),(3,1),(1,3),(2,2),(2,3),(3,3)]:
state = ttt.make_move(move,state)
ttt.display(state)
print ttt.legal_moves(state)
move = minimax_decision(state,ttt)
print move
state = ttt.make_move(move,state)
ttt.display(state)
Is how I tested it
Original comment by tom.h...@forward.co.uk on 11 Aug 2011 at 7:31
Probably would be worth pushing this fix to
http://aima.cs.berkeley.edu/python/games.py and
http://aima.cs.berkeley.edu/python/games.html
By the same token, I think http://aima.eecs.berkeley.edu/python/readme.html
should mention http://code.google.com/p/aima-python or else be synchronized.
Original comment by Franck.Dernoncourt on 12 Mar 2012 at 10:07
Original issue reported on code.google.com by
tom.h...@forward.co.uk
on 11 Aug 2011 at 6:55The text was updated successfully, but these errors were encountered: