def test_thoughtboard_root_win(self): trivial_board = Board(size=9, win_chain_length=5) trivial_board.set_to_one_move_from_win() tb = ThoughtBoard(trivial_board, FeatureBoard_v1_1) trivial_board.move(36) print(trivial_board.pprint()) move_list = MoveList((), []).append(36) self.assertTrue(trivial_board.game_won()) self.assertTrue(tb.game_over_after(move_list))
def test_deepcopy(self): board = Board(size=7, win_chain_length=4) import copy copied_board = copy.deepcopy(board) board.move(22) self.assertNotEqual(board.get_spot(22), copied_board.get_spot(22))
print('Incorrect number of coordinates, please try again!') continue x, y = inp.split(' ') try: x = int(x) y = int(y) except: print('Please input Numbers!') continue if x < 0 or x >= SIZE or y < 0 or y >= SIZE: print('Out of bounds!') continue if not board.is_move_available(x, y): print('Invalid Move!') continue result = board.move(x, y) print(board.guide_print()) else: print('Computer is thinking...') possible_moves, root_node = mind.p_search(board, False, root_node=None, save_root=False) best_move, best_node = possible_moves[0] print(" ") print(best_move, 'Q:', best_node.q) if best_node.q > PExpNode.MAX_MODEL_Q: print('Computer Resigns!')