Skip to content

Commit da014ef

Browse files
committed
updated KnottedRing w/@samanthalangit
1 parent 4bc3dc9 commit da014ef

2 files changed

Lines changed: 27 additions & 36 deletions

File tree

src/main/java/org/teachingkidsprogramming/recipes/completed/section04mastery/KnottedRing.java

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ public static void main(String[] args)
1111
Tortoise.show();
1212
// Make the tortoise move as fast as possible --#4
1313
Tortoise.setSpeed(10);
14-
// createColorPalette (recipe below) --#6
1514
createColorPalette();
16-
// Do the following 30 times --#10
15+
// Do the following 30 times --#10.1
1716
for (int i = 0; i < 30; i++)
1817
{
1918
// Change the pen color of the line the tortoise draws to the next color from the color wheel --#5
2019
Tortoise.setPenColor(ColorWheel.getNextColor());
21-
// drawOctagonWithOverlap (recipe below) --#8
20+
// drawOctagonWithOverlap (recipe below) --#8.0
2221
drawOctagonWithOverlap();
2322
// Turn the tortoise 1/30th of 360 degrees to the right --#9
2423
Tortoise.turn(360.0 / 30);
@@ -29,37 +28,27 @@ public static void main(String[] args)
2928
}
3029
private static void createColorPalette()
3130
{
32-
// ------------- Recipe for createColorPalette (HINT: Use PenColors) --#6
33-
// Add hot pink to the color wheel --#6
3431
ColorWheel.addColor(PenColors.Pinks.HotPink);
35-
// Add red to the color wheel --#12
3632
ColorWheel.addColor(PenColors.Reds.Red);
37-
// Add fuchsia to the color wheel --#13
3833
ColorWheel.addColor(PenColors.Pinks.Fuchsia);
39-
// Add orange red to the color wheel --#14
4034
ColorWheel.addColor(PenColors.Reds.OrangeRed);
41-
// Add deep pink to the color wheel --#15
4235
ColorWheel.addColor(PenColors.Pinks.DeepPink);
43-
// Add medium violet red to the color wheel --#16
4436
ColorWheel.addColor(PenColors.Reds.MediumVioletRed);
45-
// Add crimson to the color wheel --#17
4637
ColorWheel.addColor(PenColors.Reds.Crimson);
47-
// Add tomato to the color wheel --#18
4838
ColorWheel.addColor(PenColors.Reds.Tomato);
49-
// ------------- End of createColorPalette recipe --#6
5039
}
5140
private static void drawOctagonWithOverlap()
5241
{
53-
// ------------- Recipe for drawOctagonWithOverlap --#7
54-
// Do the following 8 + 1 times --#3
42+
// ------------- Recipe for drawOctagonWithOverlap --#7.1
43+
// Do the following 8 + 1 times --#3.1
5544
for (int i = 0; i < 9; i++)
5645
{
5746
// Move the tortoise 110 pixels --#1
5847
Tortoise.move(110);
5948
// Turn the tortoise 1/8th of 360 degrees to the right --#2
6049
Tortoise.turn(360.0 / 8);
6150
}
62-
// Repeat --#3
63-
// ------------- End of drawOctagonWithOverlap recipe --#7
51+
// Repeat --#3.2
52+
// ------------- End of drawOctagonWithOverlap recipe --#7.2
6453
}
6554
}
Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
11
package org.teachingkidsprogramming.section04mastery;
22

33
import org.teachingextensions.logo.Tortoise;
4+
import org.teachingextensions.logo.utils.ColorUtils.ColorWheel;
5+
import org.teachingextensions.logo.utils.ColorUtils.PenColors;
46

57
public class KnottedRing
68
{
79
public static void main(String[] args)
810
{
911
Tortoise.show();
1012
// Make the tortoise move as fast as possible --#4
11-
// createColorPalette (recipe below) --#7.1
12-
//
13-
// ------------- Recipe for createColorPalette --#7.2
14-
// Add hot pink to the color wheel --#6
15-
// Add red to the color wheel --#13
16-
// Add fuchsia to the color wheel --#14
17-
// Add orange red to the color wheel --#15
18-
// Add deep pink to the color wheel --#16
19-
// Add medium violet red to the color wheel --#17
20-
// Add crimson to the color wheel --#18
21-
// Add tomato to the color wheel --#19
22-
// ------------- End of createColorPalette recipe --#7.3
23-
// Do the following 30 times --#11.1
13+
createColorPalette();
14+
// Do the following 30 times --#10.1
2415
// Change the pen color of the line the tortoise draws to the next color from the color wheel --#5
25-
// drawOctagonWithOverlap (recipe below) --#9
26-
// ------------- Recipe for drawOctagonWithOverlap --#8.1
16+
// drawOctagonWithOverlap (recipe below) --#8.0
17+
// ------------- Recipe for drawOctagonWithOverlap --#7.1
2718
// Do the following 8 + 1 times --#3.1
2819
// Move the tortoise 110 pixels --#1
2920
// Turn the tortoise 1/8th of 360 degrees to the right --#2
3021
// Repeat --#3.2
31-
// ------------- End of drawOctagonWithOverlap recipe --#8.2
32-
// Turn the tortoise 1/30th of 360 degrees to the right --#10
33-
// Turn the tortoise 5 more degrees to the right --#12
34-
// Repeat --#11.2
22+
// ------------- End of drawOctagonWithOverlap recipe --#7.2
23+
// Turn the tortoise 1/30th of 360 degrees to the right --#9
24+
// Turn the tortoise 5 more degrees to the right --#11
25+
// Repeat --#10.2
26+
}
27+
private static void createColorPalette()
28+
{
29+
ColorWheel.addColor(PenColors.Pinks.HotPink);
30+
ColorWheel.addColor(PenColors.Reds.Red);
31+
ColorWheel.addColor(PenColors.Pinks.Fuchsia);
32+
ColorWheel.addColor(PenColors.Reds.OrangeRed);
33+
ColorWheel.addColor(PenColors.Pinks.DeepPink);
34+
ColorWheel.addColor(PenColors.Reds.MediumVioletRed);
35+
ColorWheel.addColor(PenColors.Reds.Crimson);
36+
ColorWheel.addColor(PenColors.Reds.Tomato);
3537
}
3638
}

0 commit comments

Comments
 (0)