From 52cd9dac8a44a9e35d929795070c76df5f26522a Mon Sep 17 00:00:00 2001 From: Mateusz Date: Thu, 13 Feb 2025 10:46:05 +0100 Subject: [PATCH] Second solution --- src/main/java/core/basesyntax/RobotRoute.java | 4 ---- src/main/java/core/basesyntax/main.java | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/core/basesyntax/RobotRoute.java b/src/main/java/core/basesyntax/RobotRoute.java index b6cbb2bf..cd35bcf1 100644 --- a/src/main/java/core/basesyntax/RobotRoute.java +++ b/src/main/java/core/basesyntax/RobotRoute.java @@ -5,20 +5,16 @@ public class RobotRoute { public void moveRobot(Robot robot, int toX, int toY) { while (robot.getX() != toX) { if (robot.getX() < toX) { - while (robot.getDirection() != Direction.RIGHT) { robot.turnRight(); } } else { - while (robot.getDirection() != Direction.LEFT) { robot.turnLeft(); } } robot.stepForward(); } - - while (robot.getY() != toY) { if (robot.getY() < toY) { diff --git a/src/main/java/core/basesyntax/main.java b/src/main/java/core/basesyntax/main.java index 5741a2e2..4f84de18 100644 --- a/src/main/java/core/basesyntax/main.java +++ b/src/main/java/core/basesyntax/main.java @@ -1,7 +1,7 @@ package core.basesyntax; public class main { - public static void main(String[] args) { + public static void Main(String[] args) { Robot robot = new Robot(Direction.RIGHT, 0, 0); RobotRoute robotRoute = new RobotRoute(); robotRoute.moveRobot(robot, 3, 2);