public class Square { //Pawn, knight, bishop, rook, queen, king, blank. public static final int OUT_OF_BOUNDS = -1; public static final int EMPTY = 0; public static final int PAWN = 1; public static final int KNIGHT = 2; public static final int BISHOP = 3; public static final int ROOK = 4; public static final int QUEEN = 5; public static final int KING = 6; private int type; //one of the 8 constants above. private boolean isWhite; private boolean hasMoved; private boolean isEnPassantSquare; //was jumped over by a pawn on the previous move. //en passant boolean flag (for the square that would be "captured") //boolean Knowledge of whether or not this piece moved yet (for castling) //boolean for off-the-board square public Square(Square s) { type = s.type; isWhite = s.isWhite; hasMoved = s.hasMoved; isEnPassantSquare = s.isEnPassantSquare; } public Square(int type) { this(type, false); } public Square(int type, boolean isWhite) { this.type = type; this.isWhite = isWhite; hasMoved = false; isEnPassantSquare = false; } public void clearEnPassant() { isEnPassantSquare = false; } public boolean isEnPassantSquare() { return isEnPassantSquare; } public void setEnPassantSquare(boolean whiteMovedPawnTwo) { isEnPassantSquare = true; isWhite = whiteMovedPawnTwo; } public void setHasMoved() { hasMoved = true; } public boolean isMoved() { return hasMoved; } //Positive values for white, negative for black, blank square is 0. public int getValue() { return 0; //TODO. } public int getType() { return type; } public boolean isWhite() { return isWhite; } }