Starting to implement the rules:
Patterns for moving king, bishop, knight and rook have been included.
This commit is contained in:
@ -27,25 +27,27 @@ public class Piece {
|
|||||||
//Constants used in the board representation
|
//Constants used in the board representation
|
||||||
public static final int WHITE_PIECES = WHITE;
|
public static final int WHITE_PIECES = WHITE;
|
||||||
public static final int BLACK_PIECES = BLACK;
|
public static final int BLACK_PIECES = BLACK;
|
||||||
public static final int PAWN = 2;
|
public static final int PAWN = 0;
|
||||||
public static final int WHITE_PAWN = PAWN + WHITE;
|
public static final int WHITE_PAWN = 2*(PAWN+1) + WHITE;
|
||||||
public static final int BLACK_PAWN = PAWN + BLACK;
|
public static final int BLACK_PAWN = 2*(PAWN+1) + BLACK;
|
||||||
public static final int KING = 4;
|
public static final int QUEEN = 1;
|
||||||
public static final int WHITE_KING = KING + WHITE;
|
public static final int WHITE_QUEEN = 2*(QUEEN+1) + WHITE;
|
||||||
public static final int BLACK_KING = KING + BLACK;
|
public static final int BLACK_QUEEN = 2*(QUEEN+1) + BLACK;
|
||||||
public static final int QUEEN = 6;
|
public static final int KING = 2;
|
||||||
public static final int WHITE_QUEEN = QUEEN + WHITE;
|
public static final int WHITE_KING = 2*(KING+1) + WHITE;
|
||||||
public static final int BLACK_QUEEN = QUEEN + BLACK;
|
public static final int BLACK_KING = 2*(KING+1) + BLACK;
|
||||||
public static final int BISHOP = 8;
|
public static final int BISHOP = 3;
|
||||||
public static final int WHITE_BISHOP = BISHOP + WHITE;
|
public static final int WHITE_BISHOP = 2*(BISHOP+1) + WHITE;
|
||||||
public static final int BLACK_BISHOP = BISHOP + BLACK;
|
public static final int BLACK_BISHOP = 2*(BISHOP+1) + BLACK;
|
||||||
public static final int KNIGHT = 10;
|
public static final int KNIGHT = 4;
|
||||||
public static final int WHITE_KNIGHT = KNIGHT + WHITE;
|
public static final int WHITE_KNIGHT = 2*(KNIGHT+1) + WHITE;
|
||||||
public static final int BLACK_KNIGHT = KNIGHT + BLACK;
|
public static final int BLACK_KNIGHT = 2*(KNIGHT+1) + BLACK;
|
||||||
public static final int ROOK = 12;
|
public static final int ROOK = 5;
|
||||||
public static final int WHITE_ROOK = ROOK + WHITE;
|
public static final int WHITE_ROOK = 2*(ROOK+1) + WHITE;
|
||||||
public static final int BLACK_ROOK = ROOK + BLACK;
|
public static final int BLACK_ROOK = 2*(ROOK+1) + BLACK;
|
||||||
|
|
||||||
|
public static final int MAX_PIECE_NUMBER = BLACK_ROOK;
|
||||||
|
public static final int NB_OF_PIECES = ROOK + 1;
|
||||||
|
|
||||||
//Constants used for promotion (as used in the xboard protocol)
|
//Constants used for promotion (as used in the xboard protocol)
|
||||||
public static final char KING_CHAR='k';
|
public static final char KING_CHAR='k';
|
||||||
@ -85,22 +87,22 @@ public class Piece {
|
|||||||
pieceNumber = NONE;
|
pieceNumber = NONE;
|
||||||
switch (piece) {
|
switch (piece) {
|
||||||
case PAWN_CHAR:
|
case PAWN_CHAR:
|
||||||
pieceNumber = PAWN + color;
|
pieceNumber = 2*(PAWN+1) + color;
|
||||||
break;
|
break;
|
||||||
case KING_CHAR:
|
case KING_CHAR:
|
||||||
pieceNumber = KING + color;
|
pieceNumber = 2*(KING+1) + color;
|
||||||
break;
|
break;
|
||||||
case QUEEN_CHAR:
|
case QUEEN_CHAR:
|
||||||
pieceNumber = QUEEN + color;
|
pieceNumber = 2*(QUEEN+1) + color;
|
||||||
break;
|
break;
|
||||||
case BISHOP_CHAR:
|
case BISHOP_CHAR:
|
||||||
pieceNumber = BISHOP + color;
|
pieceNumber = 2*(BISHOP+1) + color;
|
||||||
break;
|
break;
|
||||||
case KNIGHT_CHAR:
|
case KNIGHT_CHAR:
|
||||||
pieceNumber = KNIGHT + color;
|
pieceNumber = 2*(KNIGHT+1) + color;
|
||||||
break;
|
break;
|
||||||
case ROOK_CHAR:
|
case ROOK_CHAR:
|
||||||
pieceNumber = ROOK + color;
|
pieceNumber = 2*(ROOK+1) + color;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3104
src/suicideChess/Rules.java
Normal file
3104
src/suicideChess/Rules.java
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user