Pieces can be added and removed to bitboards.

I need to implement move function and it will be ok for a very basic suicide chess program
without any move checking.
This commit is contained in:
2006-01-05 15:51:46 +00:00
parent f737485337
commit c3ced2c700
4 changed files with 155 additions and 29 deletions

View File

@ -0,0 +1,78 @@
/**
*
*/
package suicideChess;
/**
* @author djib
*
* This file contains the moves representation.
*
* $LastChangedDate$
* $LastChangedRevision$
* $LastChangedBy$
*/
public class Piece {
/*************
* CONSTANTS *
*************/
/**
* Take really good care if you want to change those values
* Class BitBoard makes intensive use of those
*/
//Contants used to detect color
public static final int WHITE=0;
public static final int BLACK=1;
//Constants used in the board representation
public static final int WHITE_PIECE = WHITE;
public static final int BLACK_PIECE = BLACK;
public static final int WHITE_PAWN = 2;
public static final int BLACK_PAWN = 3;
public static final int WHITE_KING = 4;
public static final int BLACK_KING = 5;
public static final int WHITE_QUEEN = 6;
public static final int BLACK_QUEEN = 7;
public static final int WHITE_BISHOP = 8;
public static final int BLACK_BISHOP = 9;
public static final int WHITE_KNIGHT = 10;
public static final int BLACK_KNIGHT = 11;
public static final int WHITE_ROOK = 12;
public static final int BLACK_ROOK = 13;
//Constants used for promotion (as used in the xboard protocol)
public static final char KING_CHAR='k';
public static final char QUEEN_CHAR='q';
public static final char BISHOP_CHAR='b';
public static final char KNIGHT_CHAR='n';
public static final char ROOK_CHAR='r';
/****************
* PRIVATE DATA *
****************/
private static int pieceNumber;
/***************
* CONSTRUCTOR *
***************/
public Piece(int piece) {
pieceNumber = piece;
}
/***********
* METHODS *
***********/
public int getColor() {
return pieceNumber%2; //cf declaration of BLACK and WHITE above and the pieces above.
}
public int getPieceNumber() {
return pieceNumber;
}
}