Esempio n. 1
0
        public ChessBoard(BitboardLayer[] white, BitboardLayer[] black)
        {
            if (white == null || black == null)
            {
                //pawn
                ulong temp = Convert.ToUInt64("0000000011111111000000000000000000000000000000000000000000000000", 2);
                this.black[pieceIndex.PAWN] = new BitboardLayer(temp);
                temp = Convert.ToUInt64("0000000000000000000000000000000000000000000000001111111100000000", 2);
                this.white[pieceIndex.PAWN] = new BitboardLayer(temp);
                //rook
                temp = Convert.ToUInt64("1000000100000000000000000000000000000000000000000000000000000000", 2);
                this.black[pieceIndex.ROOK] = new BitboardLayer(temp);
                temp = Convert.ToUInt64("0000000000000000000000000000000000000000000000000000000010000001", 2);
                this.white[pieceIndex.ROOK] = new BitboardLayer(temp);
                //knight
                temp = Convert.ToUInt64("0100001000000000000000000000000000000000000000000000000000000000", 2);
                this.black[pieceIndex.KNIGHT] = new BitboardLayer(temp);
                temp = Convert.ToUInt64("0000000000000000000000000000000000000000000000000000000001000010", 2);
                this.white[pieceIndex.KNIGHT] = new BitboardLayer(temp);
                //bishop
                temp = Convert.ToUInt64("0010010000000000000000000000000000000000000000000000000000000000", 2);
                this.black[pieceIndex.BISHOP] = new BitboardLayer(temp);
                temp = Convert.ToUInt64("0000000000000000000000000000000000000000000000000000000000100100", 2);
                this.white[pieceIndex.BISHOP] = new BitboardLayer(temp);
                //queen
                this.black[pieceIndex.QUEEN] = new BitboardLayer(Convert.ToUInt64("0001000000000000000000000000000000000000000000000000000000000000", 2));
                this.white[pieceIndex.QUEEN] = new BitboardLayer(Convert.ToUInt64("0000000000000000000000000000000000000000000000000000000000010000", 2));
                //king
                this.black[pieceIndex.KING] = new BitboardLayer(Convert.ToUInt64("0000100000000000000000000000000000000000000000000000000000000000", 2));
                this.white[pieceIndex.KING] = new BitboardLayer(Convert.ToUInt64("0000000000000000000000000000000000000000000000000000000000001000", 2));
                //set flags used for castling
                this.white[pieceIndex.FLAGS] = new BitboardLayer(Convert.ToUInt64("111", 2)); //castling flags - left rook, king, right rook
                this.black[pieceIndex.FLAGS] = new BitboardLayer(Convert.ToUInt64("111", 2));

                getAllLocations(true);
                getAllLocations(false);
            } else
            {
                this.white = white;
                this.black = black;
            }
            ASG = new AttackedSquaresGetter(this);
        }
Esempio n. 2
0
 public ChessBoard(ChessBoard c)
 {
     for (int i = 0; i <= pieceIndex.FLAGS; i++)
     {
         white[i] = new BitboardLayer(c.getDict(true)[i]);
         black[i] = new BitboardLayer(c.getDict(false)[i]);
     }
     white_ep = c.getEP(true);
     black_ep = c.getEP(false);
     moveList = new List<int[]>(c.getMoveList());
     moveNum = c.getMoveNum();
     ASG = c.getASG();
 }
Esempio n. 3
0
        public void resetBoard()
        {
            //pawn
            ulong temp = Convert.ToUInt64("0000000011111111000000000000000000000000000000000000000000000000", 2);
            this.black[pieceIndex.PAWN] = new BitboardLayer(temp);
            temp = Convert.ToUInt64("0000000000000000000000000000000000000000000000001111111100000000", 2);
            this.white[pieceIndex.PAWN] = new BitboardLayer(temp);
            //rook
            temp = Convert.ToUInt64("1000000100000000000000000000000000000000000000000000000000000000", 2);
            this.black[pieceIndex.ROOK] = new BitboardLayer(temp);
            temp = Convert.ToUInt64("0000000000000000000000000000000000000000000000000000000010000001", 2);
            this.white[pieceIndex.ROOK] = new BitboardLayer(temp);
            //knight
            temp = Convert.ToUInt64("0100001000000000000000000000000000000000000000000000000000000000", 2);
            this.black[pieceIndex.KNIGHT] = new BitboardLayer(temp);
            temp = Convert.ToUInt64("0000000000000000000000000000000000000000000000000000000001000010", 2);
            this.white[pieceIndex.KNIGHT] = new BitboardLayer(temp);
            //bishop
            temp = Convert.ToUInt64("0010010000000000000000000000000000000000000000000000000000000000", 2);
            this.black[pieceIndex.BISHOP] = new BitboardLayer(temp);
            temp = Convert.ToUInt64("0000000000000000000000000000000000000000000000000000000000100100", 2);
            this.white[pieceIndex.BISHOP] = new BitboardLayer(temp);
            //queen
            this.black[pieceIndex.QUEEN] = new BitboardLayer(Convert.ToUInt64("0001000000000000000000000000000000000000000000000000000000000000", 2));
            this.white[pieceIndex.QUEEN] = new BitboardLayer(Convert.ToUInt64("0000000000000000000000000000000000000000000000000000000000010000", 2));
            //king
            this.black[pieceIndex.KING] = new BitboardLayer(Convert.ToUInt64("0000100000000000000000000000000000000000000000000000000000000000", 2));
            this.white[pieceIndex.KING] = new BitboardLayer(Convert.ToUInt64("0000000000000000000000000000000000000000000000000000000000001000", 2));
            //set flags used for castling
            this.white[pieceIndex.FLAGS] = new BitboardLayer(Convert.ToUInt64("111", 2)); //castling flags - left rook, king, right rook
            this.black[pieceIndex.FLAGS] = new BitboardLayer(Convert.ToUInt64("111", 2));

            getAllLocations(true);
            getAllLocations(false);

            moveList = new List<int[]>();
            moveNum = 0;

            white_ep = -1;
            black_ep = -1;

            ASG = new AttackedSquaresGetter(this);
        }