示例#1
0
    def make_move(self, brd: Board) -> MoveStruct:
        if self.is_new_game():
            self.set_player_number_for_computer(brd)
            self.create_node(brd)
        else:
            last_move = brd.get_last_move()
            assert last_move is not None, "Expected to have received a move but was None"
            node_found = self.update_node_to_child(last_move)
            if not node_found:
                self.create_node(brd, last_move)

        if GEN_GRAPH:
            use_graph_gen(self.node._board, self.neural_network)

        self.node = self.node.get_play()
        x, y = self.node.get_move()

        return x, y
示例#2
0
	def set_player_number_for_computer(self, board: Board):
		if board.get_last_move() is None:
			self.player_int = INT_PLAYER_1
		else:
			self.player_int = INT_PLAYER_2