Variables of the Board

"So, there are different kinds of pieces and they're represented by integers, right?"
"Yes"
"So yo, tell me, how do you know which is which?"
"A pawn is 1, a knight is 2, a bishop is..."
"Yeah but how does the game know?"
"I'll just make a bunch of constants in the piece class and it'll say pawn=1, knight=2, and so forth."
"But then, everytime you created a new piece, wouldn't they all contain that info making your program considerably larger, know what I'm sayin'?"
"Yeah"
"Yo, why not just put 'em in the board since there's only one board."

Piece Constants

Truely brilliant. Place the piece constants in the board, then they can be used to allocate new pieces, check whether squares are empty, check the colors of pieces on their squares and so forth. Are you following me? A piece is just two integers. Color and kind, know what I'm sayin'. There are three colors and eight kinds and the board is the one who decides which integer represents what color or what kind. And it's that simple

      final static int BLACK = 1;
      final static int WHITE = 0;
      final static int COLORLESS = 2; //empty state
      final static int EMPTYSQUARE = 0;
      final static int PAWN = 1;
      final static int KNIGHT = 2;
      final static int BISHOP = 3;
      final static int ROOK = 4;
      final static int QUEEN = 5;
      final static int KING = 6;
      final static int INVALIDPIECE = 7;

      Now, we never have to worry about it again!

Player To Move

The player that is moving changes everytime, starting with white. It goes back and forth and therefore is simply represented by a boolean. Switch it back and forth. When black is moving it's true and when white's moving it's false. You got me? Also, we can use an int representation to coincide with the colors of the pieces. This isn't so hard, is it?

Vars for Undoing Moves

To undo a move the board needs to know two things, where the piece was and where it is. Where the piece was was its sRank and sFile. Where the piece is was its eRank and eFile. Therefore, you must have a way to save this information. So, we'll have four integers, lastSRank, lastSFile, lastERank, lastEFile. Now consider that a piece was captured and it's properties emptied. How will we retrieve an empty piece. The answer is to have another piece to hold the state of the last piece. This piece should not be on the board and is used for temporary storage of the information contained in the last piece moved.

The Board

class Board {
    //the board's pieces
    static Piece board[8][8]; //accessible everywhere
    Piece undoPiece;

    //Piece Constants
    final static int WHITE = 0;
    final static int BLACK = 1;
    final static int COLORLESS = 2;
    final static int EMPTYPIECE = 0;
    final static int PAWN = 1;
    final static int KNIGHT = 2;
    final static int BISHOP = 3;
    final static int ROOK = 4;
    final static int QUEEN = 5;
    final static int KING = 6;
    final static int INVALIDPIECE = 7;

    boolean playerToMove = false; //black's moving

    //for the undoing of moves
    int lastsRank, lastsFile, lasteRank, lasteFile;
    int lastRooksRank, lastRooksFile, lastRookeRank, lastRookeFile;

    //constructor
    pubic Board(){
        //initialize the pieces         initPieces();
    }
    public void initPieces(){
        for(int i=0; i<8; i++){
            for(int j=0; j<8; j++){
            piece[i][j] = new Piece();
            }
        }
        undoPiece = new Piece();
    }//initPieces()

    //setup a new game
    public void newGame(){}

    //make a move
    public boolean DoMove(Move m){}

    //undo a move
    public void undoMove(Move m){}

    //check a path
    public boolean checkPath(Move m)

    //check for move validity
    public boolean checkValidity(Move m){}

    //make a castling move
    public boolean DoCastlingMove(Move m){}

    //undo a caslting move
    public void UnDoCastlingMove(Move m){}

    //get player moving
    public boolean getPlayerToMove(){}

    //switch players
    public void nextPlayer(){}

    //get player moving integer
    public int getSide(){}

    //get opposite player
    public int getOppositeSide(){}

}

 start