Example #1
0
        public bool InCheck(Game.PieceColor color)
        {
            ulong attacks;
            ulong king;

            if (color == Game.PieceColor.White)
            {
                king    = chessboard.WhiteKing;
                attacks = Moves.GetAllBlackMoves(chessboard);
            }
            else
            {
                king    = chessboard.BlackKing;
                attacks = Moves.GetAllWhiteMoves(chessboard);
            }
            return((king & attacks) != 0);
        }
Example #2
0
        public bool IsCheck(ulong move, int selected, Game.PieceColor color)
        {
            List <int> index = Moves.ConvertBitboard(move);

            MoveBitBoard(selected, index[0]);

            ulong attacks;
            ulong king;

            if (color == Game.PieceColor.White)
            {
                king    = chessboard.WhiteKing;
                attacks = Moves.GetAllBlackMoves(chessboard);
            }
            else
            {
                king    = chessboard.BlackKing;
                attacks = Moves.GetAllWhiteMoves(chessboard);
            }

            UndoLastMoveBitBoard();
            return((king & attacks) != 0);
        }