Пример #1
0
        public void Print(FullColorBitBoard color)
        {
            GetAllColorBitBoard(color);
            string result = "";

            for (int idx = 0; idx != 64; idx++)
            {
                if (idx == 4 || idx == 8 || idx == 12 || idx == 16 || idx == 20 || idx == 24 || idx == 28 || idx == 32 ||
                    idx == 36 || idx == 40 || idx == 44 || idx == 48 || idx == 52 || idx == 56 || idx == 60 || idx == 64)
                {
                    result += "\n";
                }
                result += GetBitValue(color, idx).ToString() + " ¦ ";
            }
            Debug.Log(result);
        }
Пример #2
0
        public long GetAllColorBitBoard(FullColorBitBoard color)
        {
            fullColorBitBoardArray[(int)color] = 0;

            if (color == FullColorBitBoard.WHITE_PIECES)
            {
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.WHITE_PAWN];
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.WHITE_ROOK];
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.WHITE_BISHOP];
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.WHITE_KNIGHT];
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.WHITE_QUEEN];
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.WHITE_KING];
            }
            else if (color == FullColorBitBoard.BLACK_PIECES)
            {
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.BLACK_PAWN];
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.BLACK_ROOK];
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.BLACK_BISHOP];
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.BLACK_KNIGHT];
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.BLACK_QUEEN];
                fullColorBitBoardArray[(int)color] |= bitBoardArray[(int)BitBoardIndex.BLACK_KING];
            }
            return(fullColorBitBoardArray[(int)color]);
        }
Пример #3
0
        private bool GetBitValue(FullColorBitBoard color, int index)
        {
            bool bit = (fullColorBitBoardArray[(int)color] & ((long)1 << index)) != 0;

            return(bit);
        }
Пример #4
0
        public void SetBitValue(FullColorBitBoard color, int index, bool state)
        {
            long tmpBoardValue = fullColorBitBoardArray[(int)color];

            fullColorBitBoardArray[(int)color] = (state) ? tmpBoardValue | ((long)1 << index) : tmpBoardValue & ~((long)1 << index);
        }