Examples of MoveList


Examples of com.barrybecker4.game.common.MoveList

     * The computer makes the first move in the game
     */
    @Override
    public void computerMovesFirst() {
        // determine the possible moves and choose one at random.
        MoveList moveList = getSearchable().generateMoves(null, weights_.getPlayer1Weights());

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

Examples of com.barrybecker4.game.common.MoveList

    @Override
    public MoveList generateMoves( TwoPlayerMove lastMove, ParameterArray weights)  {
        getProfiler().startGenerateMoves();

        MoveGenerator generator = new MoveGenerator(weights, getBoard());
        MoveList moveList  = generator.generateMoves(lastMove);

        boolean player1 = (lastMove == null) || !lastMove.isPlayer1();

        MoveList bestMoves =
            bestMoveFinder_.getBestMoves( player1, moveList);

        getProfiler().stopGenerateMoves();
        return bestMoves;
    }
View Full Code Here

Examples of com.barrybecker4.game.common.MoveList

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

Examples of com.barrybecker4.game.common.MoveList

    /*
     * generate all possible next moves.
     * impossible for this game.
     */
    public MoveList generateMoves( Move lastMove, ParameterArray weights) {
        return new MoveList();
    }
View Full Code Here

Examples of com.barrybecker4.game.common.MoveList

    public final MoveList generateEvaluatedMoves(TwoPlayerMove lastMove, ParameterArray weights) {

        GoProfiler prof = GoProfiler.getInstance();
        prof.startGenerateMoves();

        MoveList moveList = generatePossibleMoves(lastMove);

        for (Move move : moveList)  {
            setMoveValue(weights, (GoMove)move);
        }
        boolean player1 = (lastMove == null) || !lastMove.isPlayer1();
View Full Code Here

Examples of com.barrybecker4.game.common.MoveList

     * is difficult without static evaluation. At least no illegal moves will be returned.
     */
    final MoveList generatePossibleMoves(TwoPlayerMove lastMove) {

        GoBoard board = (GoBoard) searchable_.getBoard();
        MoveList moveList = new MoveList();
        int nCols = board.getNumCols();
        int nRows = board.getNumRows();

        CandidateMoveAnalyzer candidateMoves = new CandidateMoveAnalyzer(board);

        boolean player1 = (lastMove == null) || !lastMove.isPlayer1();
        int lastMoveValue = (lastMove== null) ? 0 : lastMove.getValue();

        for (int i = 1; i <= nCols; i++ )  {
            for (int j = 1; j <= nRows; j++ )  {
                // if its a candidate move and not an immediate take-back (which would break the rule of ko)
                if ( candidateMoves.isCandidateMove( j, i ) && !isTakeBack( j, i, (GoMove) lastMove, board ) ) {
                    GoMove m = new GoMove( new ByteLocation(j, i), lastMoveValue, new GoStone(player1) );

                    if ( m.isSuicidal(board) ) {
                        GameContext.log(3, "The move was a suicide (can't add it to the list): " + m);
                    }
                    else {
                        moveList.add( m );
                    }
                }
            }
        }
        return moveList;
View Full Code Here

Examples of com.barrybecker4.game.common.MoveList

    /**
     * @return all reasonably good next moves.
     */
    public final MoveList generateMoves(TwoPlayerMove lastMove, ParameterArray weights) {
        MoveList moveList = new MoveList();

        PenteBoard pb = searchable_.getBoard();
        pb.determineCandidateMoves();

        boolean player1 = (lastMove == null) || !lastMove.isPlayer1();

        int ncols = pb.getNumCols();
        int nrows = pb.getNumRows();

        for (int i = 1; i <= ncols; i++ ) {
            for (int j = 1; j <= nrows; j++ ) {
                if ( pb.isCandidateMove( j, i )) {
                    TwoPlayerMove m;
                    if (lastMove == null)
                       m = TwoPlayerMove.createMove( j, i, 0, new GamePiece(player1));
                    else
                       m = TwoPlayerMove.createMove( j, i, lastMove.getValue(), new GamePiece(player1));
                    searchable_.makeInternalMove( m );
                    m.setValue(searchable_.worth( m, weights));
                    // now revert the board
                    searchable_.undoInternalMove( m );
                    moveList.add( m );
                }
            }
        }
        BestMoveFinder finder = new BestMoveFinder(searchable_.getSearchOptions().getBestMovesSearchOptions());
        return finder.getBestMoves( player1, moveList);
View Full Code Here

Examples of com.barrybecker4.game.common.MoveList

     * @return a list of urgent moves (i.e positions that can result in a win for either player.
     */
    public MoveList generateUrgentMoves(TwoPlayerMove lastMove, ParameterArray weights) {
        // no urgent moves at start of game.
        if (lastMove == null)  {
            return new MoveList();
        }
         MoveList allMoves =
             findMovesForBothPlayers(lastMove, weights);

        // now keep only those that result in a win or loss.
        MoveList urgentMoves = new MoveList();
        boolean currentPlayer = !lastMove.isPlayer1();

        for (Move m : allMoves) {
            TwoPlayerMove move = (TwoPlayerMove) m;
            // if its not a winning move or we already have it, then skip
            if ( Math.abs(move.getValue()) >= WINNING_VALUE  && !contains(move, urgentMoves) ) {
                move.setUrgent(true);
                move.setPlayer1(currentPlayer);
                move.setPiece(new GamePiece(currentPlayer));
                urgentMoves.add(move);
            }
        }
        return urgentMoves;
    }
View Full Code Here

Examples of com.barrybecker4.game.common.MoveList

    /**
     * Consider both our moves and opponent moves.
     * @return Set of all next moves.
     */
    private MoveList findMovesForBothPlayers(TwoPlayerMove lastMove, ParameterArray weights) {
        MoveList allMoves = new MoveList();

        MoveList moves = generateMoves(lastMove, weights);
        allMoves.addAll(moves);

        // unlike go, I don't know if we need this
        TwoPlayerMove oppLastMove = lastMove.copy();
        oppLastMove.setPlayer1(!lastMove.isPlayer1());
        MoveList opponentMoves =
                generateMoves(oppLastMove, weights);
        for (Move m : opponentMoves){
            TwoPlayerMove move = (TwoPlayerMove) m;
            allMoves.add(move);
        }
View Full Code Here

Examples of org.pokenet.server.battle.mechanics.moves.MoveList

            m_moveSets = new MoveSetData();
            m_moveSets.loadFromFile(input);
            m_moveSets.pruneMoveSet(); // Slow, but avoids errors.
            m_items = new HoldItemData();
            m_items.loadItemData(input);
            m_moves = new MoveList(false);
            m_moves.loadMoveList(input);
            input.close();
           
            m_species.cacheMoveSets(m_moves, m_moveSets, false);
            m_map.put(m_uuid, this);
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.