Examples of ChessBoard


Examples of com.barrybecker4.game.twoplayer.chess.ChessBoard

    }


    @Override
    protected List getPossibleMoveList(BoardPosition position) {
        ChessBoard board = (ChessBoard)viewer_.getBoard();
        ChessController controller = (ChessController)viewer_.getController();

        ChessPiece piece = (ChessPiece)position.getPiece();
        List possibleMoveList =
            piece.findPossibleMoves(board, position.getRow(), position.getCol(),
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.chess.ChessBoard

        // we don't show dialogs if both players are computers.
        if (get2PlayerController().getPlayers().allPlayersComputer())
            return;

        int row, col;
        ChessBoard b = (ChessBoard)controller_.getBoard();
        boolean checked = false;
        for ( row = 1; row <= b.getNumRows(); row++ ) {
            for ( col = 1; col <= b.getNumCols(); col++ ) {
                BoardPosition pos = b.getPosition( row, col );
                assert (pos != null) : "pos at row="+row+" col="+col +" is null";
                if ( pos.isOccupied() && pos.getPiece().isOwnedByPlayer1() == m.isPlayer1() ) {
                    // @@ second arg is not technically correct. it should be last move, but I don't think it matters.
                    checked = b.isKingCheckedByPosition(pos, m);
                }
                if (checked) {
                    JOptionPane.showMessageDialog( this,
                        GameContext.getLabel("KING_IN_CHECK"), GameContext.getLabel("INFORMATION"), JOptionPane.INFORMATION_MESSAGE );
                    return;
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.