Skip to content

Commit

Permalink
new condition added
Browse files Browse the repository at this point in the history
  • Loading branch information
rafael60193 committed Jun 22, 2024
1 parent 0cd6e28 commit 5ac2074
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/core/basesyntax/RobotRoute.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void moveRobot(Robot robot, int toX, int toY) {
while (robot.getDirection() != Direction.LEFT) {
robot.turnRight();
}
while (robot.getDirection() == Direction.LEFT) {
while (robot.getDirection() == Direction.LEFT && robot.getX() != toX ) {
robot.stepForward();
}
} else {
Expand All @@ -32,7 +32,7 @@ public void moveRobot(Robot robot, int toX, int toY) {
while (robot.getDirection() != Direction.UP) {
robot.turnLeft();
}
while (robot.getDirection() == Direction.UP) {
while (robot.getDirection() == Direction.UP && robot.getY() != toY) {
robot.stepForward();
}
} else {
Expand Down

0 comments on commit 5ac2074

Please sign in to comment.