Examples of PlayerPathLengths


Examples of com.barrybecker4.game.twoplayer.blockade.board.path.PlayerPathLengths

               BlockadeMove.createMove(ourmove.getFromLocation(),
                                       ourmove.getToLocation(),
                                       value, ourmove.getPiece(), wall);
        // for the time being just call worth directly. Its less efficient, but simpler.
        board.makeMove(m);
        PlayerPathLengths pathLengths = board.findPlayerPathLengths();
        board.undoMove();

        if (pathLengths.isValid()) {
            m.setValue(pathLengths.determineWorth(SearchStrategy.WINNING_VALUE, weights));
            moves.add(m);
        }
        else {
            GameContext.log(2, "Did not add "+ m+ " because it was invalid.");
        }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.blockade.board.path.PlayerPathLengths

    /**
     * find all the paths from each player's pawn to each opponent base.
     */
    public PlayerPathLengths findPlayerPathLengths() {
        PlayerPathLengths playerPaths = new PlayerPathLengths();

        for ( int row = 1; row <= board.getNumRows(); row++ ) {
            for ( int col = 1; col <= board.getNumCols(); col++ ) {
                BlockadeBoardPosition pos = board.getPosition( row, col );
                if ( pos.isOccupied() ) {
                    GamePiece piece = pos.getPiece();

                    // should reuse cached path if still valid.
                    PathList paths = board.findShortestPaths(pos);

                    playerPaths.getPathLengthsForPlayer(piece.isOwnedByPlayer1()).updatePathLengths(paths);
                }
            }
        }
        return playerPaths;
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.blockade.board.path.PlayerPathLengths

        if (checkForWin(player1Moved)) {
            GameContext.log(1, "FOUND WIN!!!");
            return player1Moved ? SearchStrategy.WINNING_VALUE : -SearchStrategy.WINNING_VALUE;
        }

        PlayerPathLengths pathLengths = getBoard().findPlayerPathLengths();
        int worth = pathLengths.determineWorth(SearchStrategy.WINNING_VALUE, weights);
        getProfiler().stopCalcWorth();
        return worth;
    }
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.