public override void ValidateMove(IFigure figure, IBoard board, Move move) { var color = figure.Color; var from = move.From; var to = move.To; if (color == ChessColor.White && to.Row < from.Row) { throw new InvalidOperationException(ILLEGAL_PAWN_DIRECTION_MOVE); } if (color == ChessColor.Black && to.Row > from.Row) { throw new InvalidOperationException(ILLEGAL_PAWN_DIRECTION_MOVE); } if (CheckDiagonalMove(figure, board, from, to)) { figure.IncreaseRank(); return; } var other = board.GetFigureAtPosition(to); if (CheckAnPasseren(figure, other, from, to)) { figure.SetInPassing(); return; } if (CheckOneStepMove(figure, from, to, color, other)) { figure.IncreaseRank(); return; } ; if (CheckPassing(figure, board, to)) { figure.IncreaseRank(); return; } throw new InvalidOperationException(string.Format(ILLEGAL_PAWN_DESTINATION, to.Col, to.Row)); }