print '\n---' elif len(argv) > 1 and argv[1] == 'auto': iterations = int(argv[2]) for _ in range(iterations): board = Board() smart = choice([PLAYER1, PLAYER2]) to_move = PLAYER1 not_to_move = PLAYER2 while board.get_state()[0] == 'PENDING': if smart == to_move: move = get_best_move(to_move, not_to_move, board) board = board.add_move(move) else: move = choice(board.get_moves(to_move)) board = board.add_move(move) to_move, not_to_move = not_to_move, to_move final_state = board.get_state() if final_state[0] == 'TIE': print _, 'TIE' else: print _, 'WIN', smart == final_state[1], final_state else: run_gui()