Skip to content

Commit

Permalink
Update Digiflower
Browse files Browse the repository at this point in the history
line numbers
  • Loading branch information
lynnlangit committed Aug 16, 2018
1 parent 2446a0e commit 39e1450
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ public static void main(String[] args)
{
// Show the tortoise --#1
Tortoise.show();
// Make the tortoise move as fast as possible --#7
// Make the tortoise move as fast as possible --#6
Tortoise.setSpeed(10);
// Make the background silver (use PenColors) --#8
// Make the background silver (use PenColors) --#7
Tortoise.getBackgroundWindow().setBackground(PenColors.Grays.Silver);
// Make the line the tortoise draws 3 pixels wide --#15
// Make the line the tortoise draws 3 pixels wide --#12
Tortoise.setPenWidth(3);
// CreateColorPalette (recipe below) --#9
// CreateColorPalette (recipe below) --#8.1
createColorPalette();
// Do the following 15 times --#13
// Do the following 15 times --#11.1
for (int i = 0; i < 15; i++)
{
// DrawOctogon (recipe below) --#10
// DrawOctogon (recipe below) --#9.1
drawOctogon();
// Turn the tortoise 1/15th of 360 degrees to the right --#12
// Turn the tortoise 1/15th of 360 degrees to the right --#10
Tortoise.turn(360.0 / 15);
}
}
// ------------- Recipe for CreateColorPalette --#9
// ------------- Recipe for CreateColorPalette --#8.2
private static void createColorPalette()
{
Color color1 = PenColors.Reds.Red;
Expand All @@ -44,20 +44,22 @@ private static void createColorPalette()
ColorWheel.addColor(color3);
ColorWheel.addColor(color2);
ColorWheel.addColor(color1);
//
// ------------- End of createColorPalette recipe --#8.3
}
// ------------- Recipe for DrawOctogon --#10
// ------------- Recipe for DrawOctogon --#9.2
private static void drawOctogon()
{
// Do the following 8 times --#6
// Do the following 8 times --#5.1
for (int i = 0; i < 8; i++)
{
// Change the pen color of the line the tortoise draws to the next color on the color wheel --#4
// Change the pen color of the line the tortoise draws to the next color on the color wheel --#3
Tortoise.setPenColor(ColorWheel.getNextColor());
// Move the tortoise 50 pixels --#2
Tortoise.move(50);
// Turn the tortoise 1/8th of 360 degrees to the right --#5
// Turn the tortoise 1/8th of 360 degrees to the right --#4
Tortoise.turn(360.0 / 8);
// End Repeat --#5.2
}
// ------------- End of drawOctogon recipe --#10.3
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ public class DigiFlower
public static void main(String[] args)
{
// Show the tortoise --#1
// Make the tortoise move as fast as possible --#7
// Make the background silver --#8
// Make the line the tortoise draws 3 pixels wide --#15
// createColorPalette (recipe below) --#9.1
// Do the following 15 times --#13.1
// drawOctogon (recipe below) --#10.1
// Turn the tortoise 1/15th of 360 degrees to the right --#12
// End Repeat --#14.2
// ------------- Recipe for createColorPalette --#9.2
// Make the tortoise move as fast as possible --#6
// Make the background silver --#7
// Make the line the tortoise draws 3 pixels wide --#12
// createColorPalette (recipe below) --#8.1
// Do the following 15 times --#11.1
// drawOctogon (recipe below) --#9.1
// Turn the tortoise 1/15th of 360 degrees to the right --#10
// End Repeat --#11.2
// ------------- Recipe for createColorPalette --#8.2
Color color1 = PenColors.Reds.Red;
Color color2 = PenColors.Oranges.DarkOrange;
Color color3 = PenColors.Yellows.Gold;
Expand All @@ -31,14 +31,14 @@ public static void main(String[] args)
ColorWheel.addColor(color3);
ColorWheel.addColor(color2);
ColorWheel.addColor(color1);
// ------------- End of createColorPalette recipe --#9.3
// ------------- End of createColorPalette recipe --#8.3
//
// ------------- Recipe for drawOctogon --#10.2
// Do the following 8 times --#6.1
// Change the pen color of the line the tortoise draws to the next color on the color wheel --#4
// ------------- Recipe for drawOctogon --#9.2
// Do the following 8 times --#5.1
// Change the pen color of the line the tortoise draws to the next color on the color wheel --#3
// Move the tortoise 50 pixels --#2
// Turn the tortoise 1/8th of 360 degrees to the right --#5
// End Repeat --#6.2
// Turn the tortoise 1/8th of 360 degrees to the right --#4
// End Repeat --#5.2
// ------------- End of drawOctogon recipe --#10.3
}
}

0 comments on commit 39e1450

Please sign in to comment.