forked from League-Archive/IntroToJavaWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpiral.java
More file actions
executable file
·39 lines (21 loc) · 1.05 KB
/
Spiral.java
File metadata and controls
executable file
·39 lines (21 loc) · 1.05 KB
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
37
38
39
package section2;
import org.jointheleague.graphical.robot.Robot;
public class Spiral {
public static void main(String[] args) {
// Create a new Robot
// Set your robot's pen down
// SPEED. Set the robot to go at max speed (100)
// COUNT. Create an int variable that will count how many lines of the spiral we have drawn.
// Start its value as zero.
// LOOP. Start a while loop to repeat the COLOR, DRAW, TURN, and COUNT code below until 50 lines have been drawn
// COLOR. Have the robot set a random pen color: setRandomPenColor()
// DRAW. Move the robot (5*count) pixels
// count is the name of the variable you created earlier
// TURN. Turn the robot (360/7) degrees to the right
// COUNT. Increase the count of how many lines have been drawn so far ( count+=1 )
// Change the robot pen width to the current value of the count variable
// End the while loop here
// Run the program.
// Check the pattern against the picture in the recipe. If it matches, you are done!
}
}