Skip to content

Commit

Permalink
Second solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz committed Feb 13, 2025
1 parent fb144b4 commit 52cd9da
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions src/main/java/core/basesyntax/RobotRoute.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/core/basesyntax/main.java
Original file line number Diff line number Diff line change
@@ -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);
Expand Down

0 comments on commit 52cd9da

Please sign in to comment.