diff --git a/src/main/java/core/basesyntax/RobotRoute.java b/src/main/java/core/basesyntax/RobotRoute.java index bbdfb853..4a990648 100644 --- a/src/main/java/core/basesyntax/RobotRoute.java +++ b/src/main/java/core/basesyntax/RobotRoute.java @@ -3,19 +3,19 @@ public class RobotRoute { public void moveRobot(Robot robot, int toX, int toY) { //write your solution here - while (robot.getX() > toX && robot.getDirection() == Direction.RIGHT) { + while (robot.getX() > toX && robot.getDirection() != Direction.LEFT) { robot.turnLeft(); } - while (robot.getX() < toX && robot.getDirection() == Direction.LEFT) { + while (robot.getX() < toX && robot.getDirection() != Direction.RIGHT) { robot.turnRight(); } while (robot.getX() != toX) { robot.stepForward(); } - while (robot.getY() > toY && robot.getDirection() == Direction.UP) { + while (robot.getY() > toY && robot.getDirection() != Direction.DOWN) { robot.turnLeft(); } - while (robot.getY() < toY && robot.getDirection() == Direction.DOWN) { + while (robot.getY() < toY && robot.getDirection() != Direction.UP) { robot.turnRight(); } while (robot.getY() != toY) {