public List<Square> GetAvailableCastleMoves(Board board) { var movesList= new List<Square>(); var kingLocation = FindKingStartLocation(board); if (CheckIfKingPresent(board, kingLocation) && CastleChecker.CheckIfCastleAllowed((King)board.GetPiece(kingLocation), this, board)) movesList.Add(CastleChecker.FindCastleLocationDictionary((King)board.GetPiece(kingLocation), this, board)["rook"]); return movesList; }
public List<Square> GetAvailableCastleMoves(Board board) { var movesList = new List<Square>(); var rookLocations = FindRookStartLocations(board); for (var rookNumber = 0; rookNumber < 2; rookNumber++) { if (CheckIfRookPresent(board, rookLocations[rookNumber]) && CastleChecker.CheckIfCastleAllowed(this, (Rook)board.GetPiece(rookLocations[rookNumber]), board)) { movesList.Add(CastleChecker.FindCastleLocationDictionary(this, (Rook)board.GetPiece(rookLocations[rookNumber]), board)["king"]); } } return movesList; }