public bool EnemyInCheck() { UInt64 ret = 0; UInt64 LSB = 0; Move currentMove = this; UInt64 Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["King"]; if ((Calculator.AllPseudoPossibleKing(currentMove, LSB, currentMove.turn) & this.BoardBefore.AllBitboards[!this.turn]["King"]) > 0) { return(true); } Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["Pawn"]; if ((Calculator.AllPseudoPossiblePawn(currentMove, LSB, currentMove.turn) & this.BoardBefore.AllBitboards[!this.turn]["King"]) > 0) { return(true); } Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["Knight"]; if ((Calculator.AllPseudoPossibleKnight(currentMove, LSB, currentMove.turn) & this.BoardBefore.AllBitboards[!this.turn]["King"]) > 0) { return(true); } Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["Rook"]; LSB = LSB = BitHelper.LSB(Pieces); while (LSB > 0) { if ((Calculator.AllPseudoPossibleRook(currentMove, LSB, currentMove.turn) & this.BoardBefore.AllBitboards[!this.turn]["King"]) > 0) { return(true); } Pieces = Pieces ^ LSB; LSB = LSB = BitHelper.LSB(Pieces); } Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["Bishop"]; LSB = LSB = BitHelper.LSB(Pieces); while (LSB > 0) { if ((Calculator.AllPseudoPossibleBishop(currentMove, LSB, currentMove.turn) & this.BoardBefore.AllBitboards[!this.turn]["King"]) > 0) { return(true); } Pieces = Pieces ^ LSB; LSB = LSB = BitHelper.LSB(Pieces); } Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["Queen"]; LSB = LSB = BitHelper.LSB(Pieces); while (LSB > 0) { if ((Calculator.AllPseudoPossibleQueen(currentMove, LSB, currentMove.turn) & this.BoardBefore.AllBitboards[!this.turn]["King"]) > 0) { return(true); } Pieces = Pieces ^ LSB; LSB = LSB = BitHelper.LSB(Pieces); } return(false); }
public UInt64 Enemycheckers() { Move currentMove = this; UInt64 ret = 0; UInt64 LSB = 0; UInt64 Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["Rook"]; LSB = LSB = BitHelper.LSB(Pieces); while (LSB > 0) { if ((Calculator.AllPseudoPossibleRook(currentMove, LSB, currentMove.turn) & currentMove.BoardBefore.AllBitboards[!currentMove.turn]["King"]) > 0) { ret = ret | LSB; } Pieces = Pieces ^ LSB; LSB = LSB = BitHelper.LSB(Pieces); } Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["Bishop"]; LSB = LSB = BitHelper.LSB(Pieces); while (LSB > 0) { if ((Calculator.AllPseudoPossibleBishop(currentMove, LSB, currentMove.turn) & currentMove.BoardBefore.AllBitboards[!currentMove.turn]["King"]) > 0) { ret = ret | LSB; } Pieces = Pieces ^ LSB; LSB = LSB = BitHelper.LSB(Pieces); } Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["Queen"]; LSB = LSB = BitHelper.LSB(Pieces); while (LSB > 0) { if ((Calculator.AllPseudoPossibleQueen(currentMove, LSB, currentMove.turn) & currentMove.BoardBefore.AllBitboards[!currentMove.turn]["King"]) > 0) { ret = ret | LSB; } Pieces = Pieces ^ LSB; LSB = LSB = BitHelper.LSB(Pieces); } Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["King"]; LSB = Pieces; if ((Calculator.AllPseudoPossibleKing(currentMove, LSB, currentMove.turn) & currentMove.BoardBefore.AllBitboards[!currentMove.turn]["King"]) > 0) { ret = ret | LSB; } Pieces = Pieces ^ LSB; LSB = LSB = BitHelper.LSB(Pieces); Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["Pawn"]; LSB = LSB = BitHelper.LSB(Pieces); while (LSB > 0) { if ((Calculator.AllPseudoPossiblePawn(currentMove, LSB, currentMove.turn) & currentMove.BoardBefore.AllBitboards[!currentMove.turn]["King"]) > 0) { ret = ret | LSB; } Pieces = Pieces ^ LSB; LSB = LSB = BitHelper.LSB(Pieces); } Pieces = currentMove.BoardBefore.AllBitboards[currentMove.turn]["Knight"]; LSB = LSB = BitHelper.LSB(Pieces); while (LSB > 0) { if ((Calculator.AllPseudoPossibleKnight(currentMove, LSB, currentMove.turn) & currentMove.BoardBefore.AllBitboards[!currentMove.turn]["King"]) > 0) { ret = ret | LSB; } Pieces = Pieces ^ LSB; LSB = LSB = BitHelper.LSB(Pieces); } return(ret); }