forked from League-Archive/IntroToJavaWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMoveRobot.java
More file actions
36 lines (34 loc) · 674 Bytes
/
MoveRobot.java
File metadata and controls
36 lines (34 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import org.jointheleague.graphical.robot.Robot;
public class MoveRobot {
public static void main(String[] args) {
Robot robo = new Robot("mini");
robo.move(100);
robo.turn(90);
robo.move(100);
robo.setSpeed(10);
robo.setX(100);
robo.setY(100);
robo.move(300);
robo.setPenColor(26, 86, 12);
robo.penDown();
robo.move(100);
robo.turn(90);
robo.move(100);
robo.turn(90);
robo.move(100);
robo.turn(90);
robo.move(100);
robo.turn(90);
robo.penUp();
robo.moveTo(500, 500);
robo.penDown();
robo.setRandomPenColor();
robo.move(200);
robo.turn(60);
robo.setRandomPenColor();
robo.move(200);
robo.turn(60);
robo.setRandomPenColor();
robo.move(200);
}
}