public override IEnumerable <Square> GetAvailableMoves(Board board) { var currentPos = board.FindPiece(this); var availableMoves = lateralMove.GetLateralMoves(board, currentPos).ToList(); return(availableMoves.Where(board.IsPositionValid)); }
public override IEnumerable <Square> GetAvailableMoves(Board board) { var currentPos = board.FindPiece(this); var availableMoves = lateralMove.GetLateralMoves(board, currentPos).ToList(); availableMoves.AddRange(diagonalMove.GetDiagonalMoves(board, currentPos)); // Remove start square, duplicates and return availableMoves.RemoveAll(s => s == Square.At(4, 4)); return(availableMoves.Where(board.IsPositionValid)); }