Examples of GamePiece


Examples of com.barrybecker4.game.common.board.GamePiece

            else if (!forPlayer1 && pos.getScoreContribution() < 0)  {
                territoryEstimate -= val;  // will be positive
            }
        }
        else { // occupied
            GamePiece piece = pos.getPiece();
            IGoGroup group = pos.getGroup();
            assert(piece != null);
            if (group != null) {
                // add credit for probable captured stones.
                double relHealth = analyzerMap_.getAnalyzer(group).getRelativeHealth(board_, isEndOfGame);
                if (forPlayer1 && !piece.isOwnedByPlayer1() && relHealth >= 0) {
                    territoryEstimate += val;
                }
                else if (!forPlayer1 && piece.isOwnedByPlayer1() && relHealth <= 0)  {
                    territoryEstimate -= val;
                }
            }
        }
        return territoryEstimate;
View Full Code Here

Examples of com.barrybecker4.game.common.board.GamePiece

    public void computerMovesFirst() {
        int delta = getWinRunLength() - 1;
        Board b = (Board) getBoard();
        int c = (int) (GameContext.random().nextFloat() * (b.getNumCols() - 2 * delta) + delta + 1);
        int r = (int) (GameContext.random().nextFloat() * (b.getNumRows() - 2 * delta) + delta + 1);
        TwoPlayerMove m = TwoPlayerMove.createMove( r, c, 0, new GamePiece(true) );
        makeMove( m );
    }
View Full Code Here

Examples of com.barrybecker4.game.common.board.GamePiece

        if ( (p == null) || !p.isUnoccupied() )
            return;

        TwoPlayerMove m =
            TwoPlayerMove.createMove( loc.getRow(), loc.getCol(), 0,
                                      new GamePiece(controller.isPlayer1sTurn()));

        viewer.continuePlay( m );
    }
View Full Code Here

Examples of com.barrybecker4.game.common.board.GamePiece

     */
    public int worth( TwoPlayerMove lastMove, ParameterArray weights ) {

        int row = lastMove.getToRow();
        int col = lastMove.getToCol();
        GamePiece piece = board_.getPosition(row, col).getPiece();
        assert piece != null :
                "There must be a piece where the last move was played (" + row+", " + col + ")";
        assert (lastMove.isPlayer1() == piece.isOwnedByPlayer1()) :
                "The last move played must be for the same player found on the board.";

        // look at every string that passes through this new move to see how the value is effected.
        int diff;
        diff = horzDifferencer.findValueDifference(row, col, weights);
View Full Code Here

Examples of com.barrybecker4.game.common.board.GamePiece

        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 );
View Full Code Here

Examples of com.barrybecker4.game.common.board.GamePiece

            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
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.