public override IEnumerable <Square> GetAvailableMoves(Board board) { var currentSquare = board.FindPiece(this); var availableMoves = new List <Square>(); availableMoves.AddRange(LateralPiece.GetLateralMoves(currentSquare, board)); availableMoves.AddRange(DiagonalPiece.GetDiagonalMoves(currentSquare, board)); var invalidMoves = NotPawn.TakeOnlyOpponent(availableMoves, board); foreach (var move in invalidMoves) { availableMoves.Remove(move); } return(availableMoves); }
public override IEnumerable <Square> GetAvailableMoves(Board board) { return(LateralPiece.GetLateralMoves(board.FindPiece(this), board)); }