performance/benchmarks/bm_go.py
def play(self, board):
        """ uct tree search """
        color = board.color
        node = self
        path = [node]
        while True:
            pos = node.select(board)
            if pos == PASS:
                break
            board.move(pos)
            child = node.pos_child[pos]
            if not child:
                child = node.pos_child[pos] = UCTNode()
                child.unexplored = board.useful_moves()
                child.pos = pos
                child.parent = node
                path.append(child)
                break
            path.append(child)
            node = child
        self.random_playout(board)
        self.update_path(board, color, path)
def play(self, board):
        color = board.color
        node = self
        path = [node]
        while True:
            pos = node.select(board)
            if pos == PASS:
                break
            board.move(pos)
            child = node.pos_child[pos]
            if not child:
                child = node.pos_child[pos] = UCTNode()
                child.unexplored = board.useful_moves()
                child.pos = pos
                child.parent = node
                path.append(child)
                break
            path.append(child)
            node = child
        self.random_playout(board)
        self.update_path(board, color, path)
def play ( self , board ) : color = board . color node = self path = [ node ] while True : pos = node . select ( board ) if pos == PASS : break board . move ( pos ) child = node . pos_child [ pos ] if not child : child = node . pos_child [ pos ] = UCTNode ( ) child . unexplored = board . useful_moves ( ) child . pos = pos child . parent = node path . append ( child ) break path . append ( child ) node = child self . random_playout ( board ) self . update_path ( board , color , path )
uct tree search
uct tree search