print "******************=DONE Exploring Child = %s(sef val = %s)=======================>" % (child, value) # final_children = [child for child in children if child[3] != None] # remove non visited children # final_children.sort(key=lambda tup: tup[3]) # put min node up front print "MINIMIZING\n\n", children, "\n\nactual move\n\n", final_children,"\n\n" game.is_gameover = False print "value = %s - child = %s" % (level, player.name) return value, final_children if __name__ == '__main__': from AnimalChecker import * # from helpers import get_actual_neighbor, in_board # from sef import _sef, StageEvaluationBoard game = AnimalChecker(rows=9, cols=7, starting_player=1) game.setup() p1, p2 = game.get_players() game.display_board() _, bestMove = minimax(game, 0, 3, p1, None) bestMove = (p1[bestMove[0]], None,)+bestMove[1:-1] print "Best move = ",bestMove print game._move(*bestMove) _, bestMove = minimax(game, 0, 4, p2, None) bestMove = (p2[bestMove[0]], None,)+bestMove[1:-1] print bestMove print game._move(*bestMove)
# print Player1.tiger # print Player1.wolf # # print T.can_capture('elephant') # # print T.can_capture('WOLF') # print E > D # print W > D # print T > D # print M > D # print T > E # print E > T, E > M # print T.get_symbol() # print M.get_symbol() # # print '%s' % T game = AnimalChecker(rows=9, cols=7, starting_player=2) game.setup() p1, p2 = game.get_players() # print game.display_board() # print p1.tiger.get_location() # print p1.tiger._row_col_location # print p2.den.location # print p2.den._row_col_location # print p1.tiger.distance_from(p2.den) # print p1.tiger.distance_from(p2.mouse) # print p1.tiger.distance_from(p2.elephant) # # p2.wolf.is_dead = True # print p1.tiger.distance_from(p2.wolf) # print p1.tiger.distance_from(p1.den) print game