diff --git a/src/suicideChess/BitBoard.java b/src/suicideChess/BitBoard.java new file mode 100644 index 0000000..f111e4b --- /dev/null +++ b/src/suicideChess/BitBoard.java @@ -0,0 +1,86 @@ +package suicideChess; + +/** + * @author djib + * + * This file contains the board representation. + * The board is represented using bitboards. + * + * $LastChangedDate$ + * $LastChangedRev$ + * $LastChangedBy$ + */ + +public class BitBoard { + + /************* + * CONSTANTS * + *************/ + + //Some constants to make code more readable + public static final int NB_OF_SQUARES = 64; + + //Some constants used to access the bitboards + //Note that in suicide chess there may be more than one king + public static final int WHITE_PAWNS = 0; + public static final int BLACK_PAWNS = 1; + public static final int WHITE_KINGS = 2; + public static final int BLACK_KINGS = 3; + public static final int WHITE_QUEENS = 4; + public static final int BLACK_QUEENS = 5; + public static final int WHITE_BISHOPS = 6; + public static final int BLACK_BISHOPS = 7; + public static final int WHITE_KNIGHTS = 8; + public static final int BLACK_KNIGHTS = 9; + public static final int WHITE_ROOKS = 10; + public static final int BLACK_ROOKS = 11; + public static final int WHITE_PIECES = 12; + public static final int BLACK_PIECES = 13; + + public static final int NB_OF_BITBOARDS = 14; + + + /******** + * DATA * + ********/ + + //The following table is used to map squares to bits + private static long mapSquaresToBits[]; + + //static function used to initialise data + static { + mapSquaresToBits = new long[NB_OF_SQUARES]; + for(int i=0; iquit;"); - // break; - //} + System.err.println(xBoardCommand); + if (xBoardCommand.startsWith("quit")) { + logger.info(">quit;"); + break; + } if (xBoardCommand.startsWith("otim")) { logger.info(">Error"); System.out.println("Error (unknown command): time"); } if (xBoardCommand.startsWith("e2e4")) { - logger.info(">move b8c6"); + logger.info(">move b8b8"); System.out.println("move b8c6"); } if (xBoardCommand.startsWith("d2d4")) {