diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/PentagonCrazy.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/PentagonCrazy.java index 21e59a11..d9647f21 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/PentagonCrazy.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/PentagonCrazy.java @@ -1,32 +1,44 @@ package org.teachingkidsprogramming.recipes; +import org.teachingextensions.logo.ColorWheel; +import org.teachingextensions.logo.Colors.Blues; +import org.teachingextensions.logo.Colors.Purples; +import org.teachingextensions.logo.Tortoise; + public class PentagonCrazy { public static void main(String[] args) { - // Make the tortoise move as fast as possible --#3 - // createColorPalette (recipe below) --#8 - // ------------- Recipe for createColorPalette --#8 - // Add steel blue to the color wheel --#7 - // Add dark orchid to the color wheel --#11 - // Add dark slate blue to the color wheel --#12 - // Add teal to the color wheel --#13 - // Add indigo to the color wheel --#14 - // ------------- End of createColorPalette recipe - // DrawPentagon (recipe below) --#10 - // ------------- Recipe for drawPentagon --#10 - // Do the following 200 times --#2 - // AdjustPen (recipe below) --#9 - // ------------- Recipe for adjustPen --#9 - // Change the color of the line the tortoise draws to the next color on the color wheel --#6 - // Increase the tortoises pen width by 1 --#15 - // If the tortoises pen width is greater than 4, then --#17 - // Reset it to 1 --#16 - // ------------- End of adjustPen recipe - // Move the tortoise the length of a side --#4 - // Turn the tortoise 1/5th of 360 degrees --#1 - // Turn the tortoise 1 more degree --#5 - // Repeat - // ------------- End of drawPentagon recipe + Tortoise.setSpeed(10); + createColorPalette(); + drawPentagon(); + } + private static void drawPentagon() + { + for (int i = 1; i <= 200; i++) + { + adjustPen(); + Tortoise.move(i); + Tortoise.turn(360 / 5); + Tortoise.turn(1); + } + } + private static void adjustPen() + { + Tortoise.setPenColor(ColorWheel.getNextColor()); + Tortoise.setPenWidth(Tortoise.getPenWidth() + 1); + if (Tortoise.getPenWidth() > 4) + ; + { + Tortoise.setPenWidth(1); + } + } + private static void createColorPalette() + { + ColorWheel.addColor(Blues.SteelBlue); + ColorWheel.addColor(Purples.DarkOrchid); + ColorWheel.addColor(Blues.DarkSlateBlue); + ColorWheel.addColor(Blues.Teal); + ColorWheel.addColor(Purples.Indigo); } }