Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,27 +1,41 @@
package org.teachingkidsprogramming.section01forloops;

import org.teachingextensions.logo.Tortoise;
import org.teachingextensions.logo.utils.ColorUtils.ColorWheel;
import org.teachingextensions.logo.utils.ColorUtils.PenColors.Purples;
import org.teachingextensions.logo.utils.EventUtils.MessageBox;

public class Spiral
{
public static void main(String[] args)
{
// Show the tortoise --#1
// Make the tortoise go as fast as possible --#4
// Add Blue Violet to the Color Wheel --#7
// Add Violet to the Color Wheel --#8
// Add Purple to the Color Wheel --#9
// Do the following 75 times --#3.1
try
Tortoise.show();
for (int i = 0; i < 75; i++)
{
// Change the pen color of the line the tortoise draws the next color on the Color Wheel --#6
// Move the tortoise 5 times the current line number you are drawing --#5
// Turn the tortoise 1/3 of 360 degrees to the right --#2
// Make the tortoise go as fast as possible --#4
Tortoise.setSpeed(10);
// Add Blue Violet to the Color Wheel --#7
ColorWheel.addColor(Purples.BlueViolet);
// Add Violet to the Color Wheel --#8
ColorWheel.addColor(Purples.Violet);
// Add Purple to the Color Wheel --#9
ColorWheel.addColor(Purples.Purple);
// Do the following 75 times --#3.1
try
{
// Change the pen color of the line the tortoise draws the next color on the Color Wheel --#6
Tortoise.setPenColor(ColorWheel.getNextColor());
// Move the tortoise 5 times the current line number you are drawing --#5
Tortoise.move(i * 5);
// Turn the tortoise 1/3 of 360 degrees to the right --#2
Tortoise.turn(120);
}
catch (RuntimeException re)
{
MessageBox.showMessage("Hold up: " + re);
}
// Repeat --#3.2
}
catch (RuntimeException re)
{
MessageBox.showMessage("Hold up: " + re);
}
// Repeat --#3.2
}
}