День добрый помогите избавиться от дублирования кода, понимания в этом совершенно нету никакого потому что начинаю только осваивать язык.
namespace Mazes
{
public static class EmptyMazeTask
{
public static void MoveOut(Robot robot, int width, int height)
{
MoveRight(robot, width - 2);
MoveDown(robot, height - 2);
}
public static void MoveRight(Robot r, int steps)
{
for (int i = 1; i < steps; i++)
r.MoveTo(Direction.Right);
}
public static void MoveDown(Robot r, int steps)
{
for (int i = 1; i < steps; i++)
r.MoveTo(Direction.Down);
}
}
}