/
katherinesiv
/
CSharp_Practice3
Обзор
Документация
Войти
/
katherinesiv
/
CSharp_Practice3
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
DiagonalMazeTask.cs
31 строка
944 B
Сиваева Екатерина
create DiagonalMazeTask.cs
09 ноя 2025, 16:55
09 ноя 2025, 16:55
263d350
Код
Авторство
О чём код?
namespace Mazes; public static class DiagonalMazeTask { public static void MoveOut(Robot robot, int width, int height) { while (!robot.Finished) { if (width > height) StartDiagonalMaze(robot, width, height, Direction.Right, Direction.Down); else StartDiagonalMaze(robot, height, width, Direction.Down, Direction.Right); } } private static void MoveTo(Robot robot, int numberOfSteps, Direction direction) { for (var steps = 0; steps < numberOfSteps; steps++) robot.MoveTo(direction); } private static void StartDiagonalMaze(Robot robot, int bigValue, int smallValue, Direction first, Direction second) { while (true) { MoveTo(robot, (bigValue - 2) / (smallValue - 2), first); if (robot.Finished) break; MoveTo(robot, 1, second); } } }