Examples of BoardPosition


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

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

        for (int i=1; i<=nrows; i++) {
            for (int j=1; j<=ncols; j++) {
                BoardPosition pos = board.getPosition(i, j);
                if (pos.isOccupied()) {
                    applyPositionToKey(new ByteLocation(i, j), board.getStateIndex(pos));
                }
            }
        }
        return currentKey;
View Full Code Here

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

            PokerPlayer pp = (PokerPlayer) p.getActualPlayer();

            int row = (int) (0.93 * rowRad + (RADIUS * rowRad) * (Math.sin(angle)));
            int col = (int) (0.9 * colRad + (RADIUS * colRad) * (Math.cos(angle)));

            BoardPosition position = getPosition(row, col);
            position.setPiece(pp.getPiece());
            pp.getPiece().setLocation(position.getLocation());
            angle += angleIncrement;
        }
    }
View Full Code Here

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

        if (viewer.get2PlayerController().isProcessing() || wallPlacingMode)
            return;

        Board board = viewer.getBoard();
        Location loc = getRenderer().createLocation(e);
        BoardPosition position = board.getPosition( loc );

        // if there is no piece, or out of bounds, then return without doing anything
        if ( (position == null) || (position.isUnoccupied()) ) {
            return;
        }
        GamePiece piece = position.getPiece();
        if ( viewer.get2PlayerController().isPlayer1sTurn() != piece.isOwnedByPlayer1() )
            return; // wrong players piece

        getRenderer().setDraggedPiece(position);
    }
View Full Code Here

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

        PathList opponentPaths = board.findAllOpponentShortestPaths(player1);

        List<BoardPosition> pawnLocations = new LinkedList<BoardPosition>();
        for ( int row = 1; row <= board.getNumRows(); row++ ) {
            for ( int col = 1; col <= board.getNumCols(); col++ ) {
                BoardPosition p = board.getPosition( row, col );
                if ( p.isOccupied() && p.getPiece().isOwnedByPlayer1() == player1 ) {
                    pawnLocations.add(p);
                    addMoves( p, moveList, opponentPaths, weights_ );
                }
            }
        }
View Full Code Here

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

     */
    @Override
    protected void undoInternalMove( Move move ) {
        getProfiler().startUndoMove();
        BlockadeMove m = (BlockadeMove) move;
        BoardPosition startPos = getPosition(m.getFromRow(), m.getFromCol());
        startPos.setPiece( m.getPiece() );
        BlockadeBoardPosition toPos = getPosition(m.getToLocation());
        toPos.clear();
        if (m.capturedOpponentPawn != null) {
            toPos.setPiece(m.capturedOpponentPawn);
            m.capturedOpponentPawn = null;
View Full Code Here

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

    public String getToolTipText( MouseEvent e ) {
        Location loc = getBoardRenderer().createLocation(e);
        StringBuilder sb = new StringBuilder( "<html><font=-3>" );

        if (controller_.getBoard() != null) {
            BoardPosition space = ((IRectangularBoard)controller_.getBoard()).getPosition(loc);
            if ( space != null && space.isOccupied() && GameContext.getDebugMode() >= 0 ) {
                sb.append("<br>");
                sb.append( loc );
            }
            sb.append( "</font></html>" );
        }
View Full Code Here

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

    {
        GoBoardPosition diagPos = (GoBoardPosition)board_.getPosition( r + rowOffset, c + colOffset );
        if (diagPos == null || diagPos.isUnoccupied() || diagPos.getPiece().isOwnedByPlayer1() == groupP1 )
            return false;

        BoardPosition pos1 = board_.getPosition( r + rowOffset, c );
        BoardPosition pos2 = board_.getPosition( r, c + colOffset );

        return (pos1.isOccupied() && (pos1.getPiece().isOwnedByPlayer1() == groupP1) &&
                pos2.isOccupied() && (pos2.getPiece().isOwnedByPlayer1() == groupP1) &&
                groupAnalyzer_.isTrueEnemy(diagPos));
    }
View Full Code Here

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

        boolean player1 = stone.isOwnedByPlayer1();

        if ( !board_.inBounds( r + incr, c + incc ) ) {
            return 0;
        }
        BoardPosition adjacent1 = board_.getPosition( r + incr, c );
        BoardPosition adjacent2 = board_.getPosition( r , c + incc);
        BoardPosition diagonal = board_.getPosition( r + incr, c + incc);

        int severityScore = 0;

        if (adjacent1.isOccupied() && adjacent2.isOccupied())  {
            if (   adjacent1.getPiece().isOwnedByPlayer1() == player1
                && adjacent2.getPiece().isOwnedByPlayer1() == player1)
                severityScore += getBadShapeAux(diagonal, player1);
        }

        if (adjacent1.isOccupied() && diagonal.isOccupied())  {
            if (   adjacent1.getPiece().isOwnedByPlayer1() == player1
                && diagonal.getPiece().isOwnedByPlayer1() == player1)
                severityScore += getBadShapeAux(adjacent2, player1);
        }

        if (adjacent2.isOccupied() && diagonal.isOccupied())  {
            if (   adjacent2.getPiece().isOwnedByPlayer1() == player1
                && diagonal.getPiece().isOwnedByPlayer1() == player1)
                severityScore += getBadShapeAux(adjacent1, player1);
        }
        return severityScore;
    }
View Full Code Here

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

            return 0;
        }
        // determine the side we are checking for (one or the other)
        boolean sideTest = sameSideOnly ? friendPlayer1 : !friendPlayer1;
        if ( (nbr.getPiece().isOwnedByPlayer1() == sideTest) && !nbr.isVisited()) {
            BoardPosition diag1 = board_.getPosition(r + rowOffset, c);
            BoardPosition diag2 = board_.getPosition(r, c + colOffset);
            if (!isDiagonalCut(diag1, diag2, sideTest) )  {
                stack.add( 0, nbr );
                return 1;
            }
        }
View Full Code Here

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

        // don't add it if it is in atari
        //if (nbr.isInAtari(board_))
        //    return 0;
        if ( nbr.isOccupied() &&
            (!samePlayerOnly || nbr.getPiece().isOwnedByPlayer1() == friendPlayer1) && !nbr.isVisited() ) {
            BoardPosition oneSpacePt;
            if ( rowOffset == 0 ) {
                int col = c + (colOffset >> 1);
                oneSpacePt = board_.getPosition(r, col);
            }
            else {
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.