// Only for Player (white positions) as it would slow AI treatment public bool IsCheck() { int kingSquare = Util.GetSquareFromBitboard(whitePositions[PieceEnum.King]); ulong blackPositions = GetAllBlack(); for (int i = 63; i >= 0; i--) { if ((blackPositions & 1UL) == 1) { if (MoveManager.GetPossibleMoveList(this, i, false).Contains(kingSquare)) { return(true); } } blackPositions = blackPositions >> 1; } return(false); }
static public List <(int, int)> GetAllPossibleMoves(PositionManager board, bool isPlayer, bool isFalsePlayer) { List <(int, int)> allPossibleMoves = new List <(int, int)>(); ulong alliedPositions = (isPlayer || isFalsePlayer) ? board.GetAllWhite() : board.GetAllBlack(); for (int i = 63; i >= 0; i--) { if ((alliedPositions & 1UL) == 1) { List <int> possibleMoves = MoveManager.GetPossibleMoveList(board, i, isPlayer); foreach (int target in possibleMoves) { allPossibleMoves.Add((i, target)); } } alliedPositions = alliedPositions >> 1; } return(allPossibleMoves); }