Examples of SearchTreeNode


Examples of com.barrybecker4.game.twoplayer.common.search.tree.SearchTreeNode

            TwoPlayerMove theMove = getNextMove(list);
            updatePercentDone(depth, list);

            searchable.makeInternalMove( theMove );
            SearchTreeNode child = addNodeToTree(parent, theMove, window); i++;

            // recursive call
            selectedMove = searchInternal( theMove, depth-1, window.copy(), child );

            searchable.undoInternalMove( theMove );
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.common.search.tree.SearchTreeNode

            if (pauseInterrupted())
                return lastMove;
            updatePercentDone(depth, list);

            searchable.makeInternalMove( theMove );
            SearchTreeNode child = addNodeToTree(parent, theMove, window); i++;

            selectedMove = searchInternal( theMove, depth-1,
                     new SearchWindow(-window.beta, -Math.max(window.alpha, bestInheritedValue)), child );

            searchable.undoInternalMove( theMove );
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.common.search.tree.SearchTreeNode

               nextNode = uctSelect(lastMoveNode);
            }

            // may be null if there are no move valid moves or lastMoveNode won the game.
            if (nextNode != null) {
                SearchTreeNode nextParent = parent!=null ? parent.findChild(nextNode.move) : null;
                searchable.makeInternalMove(nextNode.move);
                player1Score = playSimulation(nextNode, nextParent);
                searchable.undoInternalMove(nextNode.move);
            } else {
                player1Score = WinProbabilityCaclulator.getChanceOfPlayer1Winning(lastMoveNode.move.getValue());
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.common.search.tree.SearchTreeNode

     * @param attributes arbitrary name value pairs to display for the new node in the tree.
     * @return the node added to the tree.
     */
    protected SearchTreeNode addNodeToTree( SearchTreeNode parent, TwoPlayerMove theMove,
                                            NodeAttributes attributes) {
        SearchTreeNode child = null;
        if (gameTree_ != null) {
            child = new SearchTreeNode(theMove, attributes);
            gameTree_.addNode(parent, child);
        }
        return child;
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.common.search.tree.SearchTreeNode

        TreePath path = tree.getPathForRow( row );
        treeViewer_.highlightPath( path );

        int chainLength = path.getPathCount();
        Object[] nodes = path.getPath();
        SearchTreeNode lastNode = (SearchTreeNode)nodes[chainLength-1];
        List<TwoPlayerMove> moveList = new LinkedList<TwoPlayerMove>();
        TwoPlayerMove m = null;
        for ( int i = 0; i < chainLength; i++ ) {
            SearchTreeNode node = (SearchTreeNode) nodes[i];
            m = (TwoPlayerMove) node.getUserObject();
            if ( m == null )
                return; // no node here
            moveList.add( m );
        }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.common.search.tree.SearchTreeNode

     * This is how the computer expects the game to play out.
     * @return the list of successive moves.
     */
    private static List<TwoPlayerMove> addSuccessiveMoves(List<TwoPlayerMove> moveList, SearchTreeNode finalNode) {

        SearchTreeNode nextNode = finalNode.getExpectedNextNode();
        while (nextNode !=  null)  {
            TwoPlayerMove m = (TwoPlayerMove)((Move)nextNode.getUserObject()).copy();
            m.setFuture(true);
            moveList.add(m);
            nextNode = nextNode.getExpectedNextNode();
        }
        return moveList;
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.common.search.tree.SearchTreeNode

    /**
     * show whatever portion of the game tree that has been searched so far.
     */
    public synchronized void showCurrentGameTree() {
        SearchTreeNode root = tree_.getTreeCopy();

        textTree_.reset(root);

        treeViewer_.setRoot(root);
        if (textTree_ == null) return;
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.common.search.tree.SearchTreeNode

        return this;
    }

    private static Color getFGColor( Object value ) {

        SearchTreeNode node = (SearchTreeNode) value;
        TwoPlayerMove m = (TwoPlayerMove) node.getUserObject();
        if ( m == null )
            return Color.gray;

        if ( m.isSelected() )
            return SELECTED_COLOR;
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.common.search.tree.SearchTreeNode

    }

    protected Color getBGColor( Object value )  {

        Color c;
        SearchTreeNode node = (SearchTreeNode) value;
        int numChildren = node.getChildCount();
        setText( getText() + " kids=" + numChildren );
        TwoPlayerMove m = (TwoPlayerMove) node.getUserObject();
        if ( m == null ) return Color.gray;    // passing move?

        if (colormap_ != null) {
            c = colormap_.getColorForValue(m.getInheritedValue());
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.