Package com.barrybecker4.game.common

Examples of com.barrybecker4.game.common.MoveList


     */
    @Override
    public void computerMovesFirst() {

        // determine the possible moves and choose one at random.
        MoveList moveList = getSearchable().generateMoves( null, weights_.getPlayer1Weights());

        makeMove( moveList.getRandomMove() );
        player1sTurn_ = false;
    }
View Full Code Here


    public MoveList generateMoves(TwoPlayerMove lastMove, ParameterArray weights) {

        MoveGenerator generator = new MoveGenerator(this, weights);
        boolean player1 = (lastMove == null) || !lastMove.isPlayer1();

        MoveList moveList = generator.generateMoves(lastMove);

        return bestMoveFinder_.getBestMoves( player1, moveList);
    }
View Full Code Here

     * @return list of urgent moves
     */
    @Override
    public MoveList generateUrgentMoves(
            TwoPlayerMove lastMove, ParameterArray weights) {
        return new MoveList();
    }
View Full Code Here

        TwoPlayerMove lastMove = (TwoPlayerMove)controller.getLastMove();
        MoveGenerator generator =
                new MoveGenerator((CheckersSearchable)controller.getSearchable(),
                                  controller.getComputerWeights().getDefaultWeights());

        MoveList possibleMoveList = new MoveList();
        generator.addMoves(position, lastMove, possibleMoveList);
        return possibleMoveList;
    }
View Full Code Here

    @Override
    public void addPrunedNodes(final MoveList list, final SearchTreeNode parent,
                               final int i, final NodeAttributes attributes) {
        synchronized (root_) {
            // make a defensive copy of the list because we may modify it.
            final MoveList listCopy = new MoveList(list);
            parent.addPrunedChildNodes(listCopy, i, attributes);
        }
    }
View Full Code Here

            entry = new Entry(lastMove, -lastMove.getInheritedValue());
            lookupTable.put(key, entry);
            return lastMove;
        }

        MoveList list = searchable.generateMoves(lastMove, weights_);

        if (depth == lookAhead_)
            numTopLevelMoves_ = list.size();

        if ( emptyMoveList(list, lastMove) )  return null;

        return findBestMove(lastMove, depth, list, window, parent);
    }
View Full Code Here

            entry.upperValue = value;
            lookupTable.put(key, entry);
            return lastMove;
        }

        MoveList list = searchable.generateMoves(lastMove, weights_);

        if (depth == lookAhead_)
            numTopLevelMoves_ = list.size();

        if ( emptyMoveList( list, lastMove) )   return null;

        return findBestMove(lastMove, depth, list, window, parent);
    }
View Full Code Here

        if (numRandMoves >= numRandomLookAhead || searchable.done(lastMove, false)) {
            int score = searchable.worth(lastMove, weights_);
            lastMove.setValue(score);
            return WinProbabilityCaclulator.getChanceOfPlayer1Winning(score);
        }
        MoveList moves = searchable.generateMoves(lastMove, weights_);
        if (moves.size() == 0) {
            return WinProbabilityCaclulator.getChanceOfPlayer1Winning(lastMove.getValue());
        }
        TwoPlayerMove randomMove = (TwoPlayerMove) moves.getRandomMoveForThresh(percentLessThanBestThresh);

        searchable.makeInternalMove(randomMove);
        return playRandomMove(randomMove, searchable, startNumMoves);
    }
View Full Code Here

                return lastMove;
            }
        }

        // generate a list of all (or bestPercent) candidate next moves, and pick the best one
        MoveList list = searchable.generateMoves(lastMove,  weights_);

        if (depth == lookAhead_)
            numTopLevelMoves_ = list.size();

        if (emptyMoveList(list, lastMove)) {
            updatePercentDone(depth, list);
            // if there are no possible next moves, return null (we hit the end of the game).
            return null;
View Full Code Here

     * @return best quiescent move
     */
    TwoPlayerMove quiescentSearch(TwoPlayerMove lastMove,
                                  int depth, SearchWindow window, SearchTreeNode parent) {

        MoveList urgentMoves = searchable.generateUrgentMoves(lastMove, weights_);
        if (emptyMoveList(urgentMoves, lastMove)) return null;

        return findBestMove(lastMove, depth, urgentMoves, window, parent);
    }
View Full Code Here

TOP

Related Classes of com.barrybecker4.game.common.MoveList

Copyright © 2018 www.massapicom. 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.