diff --git a/Game1/.classpath b/Game1/.classpath
new file mode 100644
index 00000000..fb501163
--- /dev/null
+++ b/Game1/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Game1/.project b/Game1/.project
new file mode 100644
index 00000000..e8a954f8
--- /dev/null
+++ b/Game1/.project
@@ -0,0 +1,17 @@
+
+
+ Game1
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/TeachingKidsProgramming/.class.virtual_proctor.txt b/TeachingKidsProgramming/.class.virtual_proctor.txt
new file mode 100644
index 00000000..38c00440
--- /dev/null
+++ b/TeachingKidsProgramming/.class.virtual_proctor.txt
@@ -0,0 +1 @@
+Grace Hopper's Class
\ No newline at end of file
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/Spiral.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/Spiral.java
index 74fc0600..77e2a6e2 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/Spiral.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/Spiral.java
@@ -11,7 +11,7 @@ public static void main(String[] args)
{
// Show the tortoise --#1
Tortoise.show();
- for (int i = 0; i < 75; i++)
+ for (int i = 0; i < 1000; i++)
{
// Make the tortoise go as fast as possible --#4
Tortoise.setSpeed(10);
@@ -27,9 +27,9 @@ public static void main(String[] args)
// 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);
+ Tortoise.move(i * 1);
// Turn the tortoise 1/3 of 360 degrees to the right --#2
- Tortoise.turn(125);
+ Tortoise.turn(79);
}
catch (RuntimeException re)
{
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/RecursiveSquare.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/RecursiveSquare.java
index 72fa3f8d..881a2405 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/RecursiveSquare.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/RecursiveSquare.java
@@ -12,31 +12,54 @@ public static void main(String[] args) throws Exception
Tortoise.setPenColor(PenColors.Yellows.Gold);
//
// Set the speed to the fastest --#8
+ Tortoise.setSpeed(10);
// Update the length to 100.0 --#1.1
- double length = 50.0;
+ double length = 100.0;
// MakeASquare with the current length(recipe below) --#11.4
//
+ makeASquare(length);
+ //We fixed a recursion problem
+ for (int i = 0; i < 4; i++)
+ {
+ length = length / 1.7;
+ makeASquare(length);
+ }
+ }
+ private static void makeASquare(double length)
+ {
// Create the makeASquare recipe --#11.1
// If the current length is greater than 10 --#10.2
- // Run the recipe moveToTheSquareStart with the current length --#4.3
- //
- // Create the moveToTheSquareStart recipe --#4.1
- // Set the pen up for the tortoise --#1.2
- // Move the tortoise the current length divided by two --#1.3
- // Turn the tortoise 90 degrees to the left --#2.1
- // Move the tortoise the current length divided by two --#2.2
- // Turn the tortoise 180 degrees to the right --#3.1
- // Set the pen down for the tortoise --#3.2
- // End of moveToTheSquareStart recipe --#4.2
+ if (length > 10)
+ {
+ // Run the recipe moveToTheSquareStart with the current length --#4.3
+ moveToTheSquareStart(length);
+ }
//
// Do the following 4 times --#7.1
- // Move the Tortoise the current length --#6.2
- // MakeASquare with the current length divided by 1.7 (recipe below)--#11.3
- // If the current process count is less than 3 (HINT: use 'i') --#9
- // Turn the tortoise 90 degrees to the right --#6.1
- // Repeat --#7.2
+ for (int i = 0; i < 4; i++)
+ {
+ // Move the Tortoise the current length --#6.2
+ Tortoise.move(length);
+ // MakeASquare with the current length divided by 1.7 (recipe below)--#11.3
+ // If the current process count is less than 3 (HINT: use 'i') --#9
+ if (i < 3)
+ {
+ // Turn the tortoise 90 degrees to the right --#6.1
+ Tortoise.turn(90);
+ }
+ // Repeat --#7.2
+ }
//
// MoveBackToCenter with the current length (recipe below)--#5.3
+ moveBackToCenter(length);
+ //
+ // Set the current length to the current length times two --#10.1
+ length = length * 2;
+ //
+ // End of makeASquare recipe --#11.2
+ }
+ private static void moveBackToCenter(double length)
+ {
// Create the moveBackToCenter recipe --#5.1
Tortoise.setPenUp();
Tortoise.turn(90);
@@ -48,9 +71,22 @@ public static void main(String[] args) throws Exception
//
//
// End of moveBackToCenter recipe--#5.2
- //
- // Set the current length to the current length times two --#10.1
- //
- // End of makeASquare recipe --#11.2
+ }
+ private static void moveToTheSquareStart(double length)
+ {
+ // Create the moveToTheSquareStart recipe --#4.1
+ // Set the pen up for the tortoise --#1.2
+ Tortoise.setPenUp();
+ // Move the tortoise the current length divided by two --#1.3
+ Tortoise.move(length / 2);
+ // Turn the tortoise 90 degrees to the left --#2.1
+ Tortoise.turn(-90);
+ // Move the tortoise the current length divided by two --#2.2
+ Tortoise.move(length / 2);
+ // Turn the tortoise 180 degrees to the right --#3.1
+ Tortoise.turn(180);
+ // Set the pen down for the tortoise --#3.2
+ Tortoise.setPenDown();
+ // End of moveToTheSquareStart recipe --#4.2
}
}
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/TurtleTree.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/TurtleTree.java
index 77b31274..22733d1a 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/TurtleTree.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/TurtleTree.java
@@ -4,50 +4,91 @@
import java.util.HashMap;
import org.teachingextensions.logo.Tortoise;
+import org.teachingextensions.logo.utils.ColorUtils.PenColors.Browns;
+import org.teachingextensions.logo.utils.ColorUtils.PenColors.Grays;
+import org.teachingextensions.logo.utils.ColorUtils.PenColors.Greens;
public class TurtleTree
{
- @SuppressWarnings("unused")
public static void main(String[] args)
{
Tortoise.show();
// Make the tortoise go as fast as possible --#10
+ Tortoise.setSpeed(10);
// Turn the background black --#21
+ Tortoise.getBackgroundWindow().setBackground(Grays.Black);
// The current branch length = 60 --#1.2
+ int branchLength = 60;
// drawBranch(recipe below) --#2.1
//
+ drawBranch(branchLength);
+ }
+ private static void drawBranch(int branchLength)
+ {
// ------------- Recipe for drawBranch --#2.2
// If the current branch length is greater than zero, do the rest of this recipe --#5
- // adjustColor (recipe below)--#15.1
+ if (branchLength > 0)
+ {
+ // adjustColor (recipe below)--#15.1
+ adjustColor(branchLength);
+ //
+ // Move the tortoise the length of the current branch --#1.1
+ Tortoise.move(branchLength);
+ // drawLowerBranches (recipe below) --#6.1
+ adjustColor(branchLength);
+ //
+ drawLowerBranches(branchLength);
+ branchLength = branchLength + 10;
+ adjustColor(branchLength);
+ //
+ }
+ // ------------- End of drawBranch recipe --#2.3
+ }
+ private static void drawLowerBranches(int branchLength)
+ {
+ // ------------- Recipe for drawLowerBranches --#6.2
+ // Turn the Tortoise 30 degrees to the right --#3
+ Tortoise.turn(30);
+ // drawShorterBranch (recipe below) --#8.1
+ //
+ drawShorterBranch(branchLength);
+ //
+ // Turn the Tortoise 60 degrees to the left --#7
+ Tortoise.turn(-60);
+ // drawShorterBranch --#9
+ drawShorterBranch(branchLength);
+ // Turn the Tortoise 30 degrees to the right --#12
+ Tortoise.turn(30);
+ // adjustColor --#16
+ // Move the tortoise backward the length of the current branch --#11
+ Tortoise.move(-branchLength);
+ // ------------- End of drawLowerBranches recipe --#6.3
+ }
+ private static void adjustColor(int branchLength)
+ {
// ------------- Recipe for adjustColor --#15.2
HashMap colors = new HashMap();
// A 10 pixel long branch is lime --#20
+ colors.put(10, Greens.Lime);
// A 20 pixel long branch is forest green --#19
+ colors.put(20, Greens.ForestGreen);
// A 30 pixel long branch is dark green --#18
+ colors.put(30, Greens.DarkGreen);
// A 40 pixel long branch is olive --#17
+ colors.put(40, Greens.Olive);
// A 50 pixel long branch is sienna --#14
+ colors.put(50, Browns.Sienna);
// A 60 pixel long branch is saddle brown (TIP: Put the values into the 'colors' HashMap)--#13
+ colors.put(60, Browns.SaddleBrown);
// Get the value of the branch length from the 'colors' HashMap and use that to set the pen color --#21
+ Tortoise.setPenColor(colors.get(branchLength));
// ------------- End of adjustColor --#15.3
- //
- // Move the tortoise the length of the current branch --#1.1
- // drawLowerBranches (recipe below) --#6.1
- //
- // ------------- Recipe for drawLowerBranches --#6.2
- // Turn the Tortoise 30 degrees to the right --#3
- // drawShorterBranch (recipe below) --#8.1
- //
+ }
+ private static void drawShorterBranch(int branchLength)
+ {
// ------------- Recipe for drawShorterBranch --#8.2
// drawBranch (10 pixels shorter) --#4
+ drawBranch(branchLength - 10);
// ------------- End of drawShorterBranch recipe --#8.3
- //
- // Turn the Tortoise 60 degrees to the left --#7
- // drawShorterBranch --#9
- // Turn the Tortoise 30 degrees to the right --#12
- // adjustColor --#16
- // Move the tortoise backward the length of the current branch --#11
- // ------------- End of drawLowerBranches recipe --#6.3
- //
- // ------------- End of drawBranch recipe --#2.3
}
}
\ No newline at end of file
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibs.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibs.java
index 65f70c38..bede1ef1 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibs.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibs.java
@@ -1,16 +1,176 @@
package org.teachingkidsprogramming.section06modelviewcontroller;
+import org.teachingextensions.logo.Tortoise;
+import org.teachingextensions.logo.utils.ColorUtils.PenColors.Whites;
+import org.teachingextensions.logo.utils.EventUtils.MessageBox;
+
public class AdLibs
{
public static void main(String[] args)
{
// Ask the user to enter an adverb, save it as currentAdverb --#2
+ String currentAdverb = MessageBox.askForTextInput("enter an adverb");
// Ask the user to enter a verb ending in '-ed', save it as currentEdVerb --#4
+ String currentEdVerb = MessageBox.askForTextInput("enter a verb ending in '-ed'");
// Ask the user to enter a body part, save it as currentBodyPart --#6
+ String currentBodyPart = MessageBox.askForTextInput("enter a body part");
+ // Ask the user for a sentence
+ String sentence = MessageBox.askForTextInput("Write a sentence that starts with 'I' and has an action");
// Set the value of the currentStory to the word "Today " --#1.2
+ String currentStory = "Today ";
// Add the words "I woke " + currentAdverb + ". " to the currentStory --#3
+ currentStory += "I woke " + currentAdverb + ". ";
// Add the words '"Then I " + currentEdVerb + " " to the currentStory --#5
+ currentStory += "Then I " + currentEdVerb + " ";
// Add the words "my " + currentBodyPart + ". " to the current story --#7
+ currentStory += "my " + currentBodyPart + ". ";
+ // Add the words 'After that, ' + sentence
+ currentStory += "After that, " + sentence;
// Show the currentStory in a message box as a message --#1.1
+ MessageBox.showMessage(currentStory);
+ // Is this the end?
+ String theEnd = MessageBox.askForTextInput("Is this the end? 'Yes' or 'No'");
+ // Write end with Tortoise
+ theEnd();
+ }
+ private static void theEnd()
+ {
+ Tortoise.show();
+ Tortoise.setX(270);
+ Tortoise.setY(400);
+ Tortoise.setSpeed(10);
+ Tortoise.setPenWidth(7);
+ Tortoise.move(150);
+ Tortoise.turn(90);
+ Tortoise.move(50);
+ Tortoise.move(-50);
+ Tortoise.turn(90);
+ Tortoise.move(75);
+ Tortoise.turn(-90);
+ Tortoise.move(50);
+ Tortoise.move(-50);
+ Tortoise.turn(90);
+ Tortoise.move(75);
+ Tortoise.turn(-90);
+ Tortoise.move(75);
+ Tortoise.turn(-90);
+ Tortoise.move(150);
+ Tortoise.turn(155);
+ Tortoise.move(166.5);
+ Tortoise.turn(-155);
+ Tortoise.move(150);
+ Tortoise.move(-150);
+ Tortoise.turn(90);
+ Tortoise.move(25);
+ Tortoise.turn(-90);
+ Tortoise.move(150);
+ Tortoise.move(-150);
+ Tortoise.turn(75);
+ for (int j = 0; j < 23; j++)
+ {
+ Tortoise.move(j);
+ Tortoise.turn(-j / 1.5);
+ }
+ Tortoise.setAngle(270);
+ Tortoise.move(150);
+ Tortoise.turn(90);
+ Tortoise.move(150);
+ Tortoise.turn(90);
+ Tortoise.move(50);
+ Tortoise.move(-50);
+ Tortoise.turn(90);
+ Tortoise.move(75);
+ Tortoise.turn(-90);
+ Tortoise.move(50);
+ Tortoise.move(-50);
+ Tortoise.turn(90);
+ Tortoise.move(75);
+ Tortoise.turn(90);
+ Tortoise.move(25);
+ Tortoise.turn(90);
+ Tortoise.move(150);
+ Tortoise.move(-75);
+ Tortoise.turn(-90);
+ Tortoise.move(62);
+ Tortoise.turn(90);
+ Tortoise.move(75);
+ Tortoise.move(-150);
+ Tortoise.turn(-90);
+ Tortoise.move(65);
+ Tortoise.turn(90);
+ Tortoise.move(150);
+ Tortoise.turn(90);
+ Tortoise.move(35);
+ Tortoise.move(-70);
+ Tortoise.show();
+ Tortoise.setX(270);
+ Tortoise.setY(400);
+ Tortoise.setSpeed(10);
+ Tortoise.setPenWidth(5);
+ Tortoise.setPenColor(Whites.White);
+ Tortoise.setAngle(0);
+ Tortoise.move(150);
+ Tortoise.turn(90);
+ Tortoise.move(50);
+ Tortoise.move(-50);
+ Tortoise.turn(90);
+ Tortoise.move(75);
+ Tortoise.turn(-90);
+ Tortoise.move(50);
+ Tortoise.move(-50);
+ Tortoise.turn(90);
+ Tortoise.move(75);
+ Tortoise.turn(-90);
+ Tortoise.move(75);
+ Tortoise.turn(-90);
+ Tortoise.move(150);
+ Tortoise.turn(155);
+ Tortoise.move(166.5);
+ Tortoise.turn(-155);
+ Tortoise.move(150);
+ Tortoise.move(-150);
+ Tortoise.turn(90);
+ Tortoise.move(25);
+ Tortoise.turn(-90);
+ Tortoise.move(150);
+ Tortoise.move(-150);
+ Tortoise.turn(75);
+ for (int j = 0; j < 23; j++)
+ {
+ Tortoise.move(j);
+ Tortoise.turn(-j / 1.5);
+ }
+ Tortoise.setAngle(270);;
+ Tortoise.move(150);
+ Tortoise.turn(90);
+ Tortoise.move(150);
+ Tortoise.turn(90);
+ Tortoise.move(50);
+ Tortoise.move(-50);
+ Tortoise.turn(90);
+ Tortoise.move(75);
+ Tortoise.turn(-90);
+ Tortoise.move(50);
+ Tortoise.move(-50);
+ Tortoise.turn(90);
+ Tortoise.move(75);
+ Tortoise.turn(90);
+ Tortoise.move(25);
+ Tortoise.turn(90);
+ Tortoise.move(150);
+ Tortoise.move(-75);
+ Tortoise.turn(-90);
+ Tortoise.move(62);
+ Tortoise.turn(90);
+ Tortoise.move(75);
+ Tortoise.move(-150);
+ Tortoise.turn(-90);
+ Tortoise.move(65);
+ Tortoise.turn(90);
+ Tortoise.move(150);
+ Tortoise.turn(90);
+ Tortoise.move(35);
+ Tortoise.move(-70);
+ Tortoise.hide();
}
}
\ No newline at end of file
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsQuiz.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsQuiz.java
index 3bc77a19..f6e28a69 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsQuiz.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsQuiz.java
@@ -1,5 +1,6 @@
package org.teachingkidsprogramming.section06modelviewcontroller;
+import org.teachingextensions.logo.utils.MVCUtils.Parser;
import org.teachingkidsprogramming.recipes.quizzes.graders.AdLibsQuizAdapter;
import org.teachingkidsprogramming.recipes.quizzes.graders.AdLibsQuizGrader;
@@ -9,24 +10,26 @@ public class AdLibsQuiz extends AdLibsQuizAdapter
public void question1(String letter1, String letter3)
{
// Set current value of word1 to be letter1 + 'o' + letter3
+ word1 = letter1 + 'o' + letter3;
}
@Override
public void question2(String letter1)
{
// Add the letter1 to the end of word2
+ word2 += letter1;
}
@Override
public void question3(String templateText, Object model)
{
// Use the parser to combine the template and the model as word3
+ Parser.parse(templateText, model);
}
@Override
public void question4(Pieces pieces)
{
// Set template4 to the template which does'g' + pieces.middle + 'e'
+ {
+ new AdLibsQuizGrader().grade(new AdLibsQuiz());
+ }
}
- public static void main(String[] args)
- {
- new AdLibsQuizGrader().grade(new AdLibsQuiz());
- }
-}
+}
\ No newline at end of file
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsRtf.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsRtf.java
index cf0abe93..70ec6500 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsRtf.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsRtf.java
@@ -1,16 +1,30 @@
package org.teachingkidsprogramming.section06modelviewcontroller;
+import org.teachingextensions.logo.utils.EventUtils.MessageBox;
+import org.teachingextensions.logo.utils.MVCUtils.Parser;
+import org.teachingextensions.logo.utils.MVCUtils.Viewer;
public class AdLibsRtf
{
+ public static class Words
+ {
+ public String adverb;
+ public String edVerb;
+ public String bodyPart;
+ }
public static void main(String[] args)
{
- // Create a new 'word' container your story's words (uncomment line 10) --#1.1
- // Words word = new Words();
+ // Create a new 'word' container to hold the words for your story --#1.1
+ Words word = new Words();
// Ask the user to enter an adverb, save it as currentAdverb --#2
+ word.adverb = MessageBox.askForTextInput("What is the adverb?");
// Ask the user to enter a verb ending in '-ed', save it as currentEdVerb --#3
+ word.edVerb = MessageBox.askForTextInput("What is the -ed verb?");
// Ask the user to enter a body part, save it as currentBodyPart --#4
+ word.bodyPart = MessageBox.askForTextInput("What is the body part?");
// Connect the words in the currentStory to an RTF file parser (use the Parser object) --#1.2
+ String currentStory = Parser.parseRtfFile("view.rtf", word);
// Display the currentStory in an RTF file (use the Viewer object) --#1.3
+ Viewer.displayRtfFile(currentStory);
}
}
\ No newline at end of file
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/OneFishTwoFish.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/OneFishTwoFish.java
index ea262ca3..c8772ada 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/OneFishTwoFish.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/OneFishTwoFish.java
@@ -5,6 +5,7 @@
public class OneFishTwoFish
{
// Create a Scanner to make a string --#1
+ private static Scanner Scanner;
public static void main(String[] args)
{
makeAString();
@@ -13,6 +14,7 @@ public static void makeAString()
{
final String input = "1 fish 2 fish red fish blue fish,black fish,blue fish,old fish,new fish ";
// Use your scanner with your input --#2
+ scanner = new Scanner(input);
// Display a new line and "We have: " and the input and then a new line --#3
// Now, tell a story with a new Scanner instance (tellAStory recipe) --#8
}
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/CloneTurtles.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/CloneTurtles.java
index 257e667a..09fcb292 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/CloneTurtles.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/CloneTurtles.java
@@ -1,10 +1,17 @@
package org.teachingkidsprogramming.section07objects;
+import java.util.ArrayList;
+
+import org.teachingextensions.WindowUtils.MultiTurtleWindow;
+import org.teachingextensions.logo.Turtle;
+import org.teachingextensions.logo.utils.ColorUtils.PenColors;
+import org.teachingextensions.logo.utils.LineAndShapeUtils.Text;
+
public class CloneTurtles
{
- // Uncomment the two lines of code below to create a container and a window for your turtles --#1
- // public ArrayList turtles = new ArrayList();
- // public MultiTurtleWindow mtw = new MultiTurtleWindow();
+ //Uncomment the two lines of code below to create a container and a window for your turtles --#1
+ public ArrayList turtles = new ArrayList();
+ public MultiTurtleWindow mtw = new MultiTurtleWindow();
//
public CloneTurtles()
{
@@ -13,29 +20,48 @@ public CloneTurtles()
//
private void showSomeTurtles()
{
- // Use a FOR loop to add your three turtles --#4.1
- // Create a turtle instance --#2.1
- // Add your turtles to your turtle container --#2.2
- // Repeat --#4.2
- //
- // Create a variable to count the number of turtles in the container --#3.1
- // Uncomment to Show the number of turtles in the container on the window --#3.2
- // new Text("There are " + numberOfTurtles + " turtles in the turtle container").setTopLeft(50, 50).setPenColor(PenColors.Yellows.Gold).addTo(mtw);
- //
- // Use a FOREACH loop to add your turtles to your window --#5.1
- // Add and Show your turtles on your window --#5.3
- // Repeat --#5.2
- //
- // Use a FOR loop to teleport all of your turtles around your window --#6.1
- // Get your turtle's current position and then set the X position to i*100 + 350 --#6.3
- // Get your turtle's current position and then set the Y position to i*100 + 100 --#6.4
- // Repeat --#6.2
+ //Use a FOR loop to add your three turtles --#4.1
+ for (int i = 0; i < 3; i++)
+ {
+ //Create a turtle instance --#2.1
+ Turtle myTurtle = new Turtle();
+ //Add your turtles to your turtle container --#2.2
+ turtles.add(myTurtle);
+ //Repeat --#4.2
+ }
+ //Create a variable to count the number of turtles in the container --#3.1
+ int numberOfTurtles = turtles.size();
+ //Uncomment to Show the number of turtles in the container on the window --#3.2
+ new Text("There are " + numberOfTurtles + " turtles in the turtle container").setTopLeft(50, 50)
+ .setPenColor(PenColors.Yellows.Gold).addTo(mtw);
//
- // Use a FOREACH loop to set values for all of your turtles --#7.1
- // Set the pen width to 10 pixels -- #7.3
- // Set the turtle speed to 9 --#7.4
- // Have each turtle draw a star with a side that is 100 pixels --#7.5
- // Repeat --#7.2
+ //Use a FOREACH loop to add your turtles to your window --#5.1
+ for (Turtle turtle : turtles)
+ {
+ //Add and Show your turtles on your window --#5.3
+ mtw.addAndShowTurtle(turtle);
+ //Repeat --#5.2
+ }
+ //Use a FOR loop to teleport all of your turtles around your window --#6.1
+ for (int i = 0; i < 3; i++)
+ {
+ //Get your turtle's current position and then set the X position to i*100 + 350 --#6.3
+ turtles.get(i).setX(i * 100 + 350);
+ //Get your turtle's current position and then set the Y position to i*100 + 100 --#6.4
+ turtles.get(i).setY(i * 100 + 100);
+ //Repeat --#6.2
+ }
+ //Use a FOREACH loop to set values for all of your turtles --#7.1
+ for (Turtle turtle : turtles)
+ {
+ //Set the pen width to 10 pixels -- #7.3
+ turtle.setPenWidth(10);
+ //Set the turtle speed to 9 --#7.4
+ turtle.setSpeed(9);
+ //Have each turtle draw a star with a side that is 100 pixels --#7.5
+ turtle.drawStar(100);
+ //Repeat --#7.2
+ }
}
//
public static void main(String[] args)
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/SuperTurtles.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/SuperTurtles.java
index bc5ab2c2..4d284881 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/SuperTurtles.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/SuperTurtles.java
@@ -1,6 +1,8 @@
package org.teachingkidsprogramming.section07objects;
import org.teachingextensions.WindowUtils.MultiTurtleWindow;
+import org.teachingextensions.logo.Sound;
+import org.teachingextensions.logo.Turtle;
public class SuperTurtles
{
@@ -16,23 +18,43 @@ public static void main(String[] args)
private void showSomeTurtles()
{
// makeSpeedyTurtle (recipe below) --#2.0
- // ------------- Recipe for makeSpeedyTurtle --#1.0
- // Create a new speedyTurtle instance
- // Add your speedyTurtle to your MultiTurtleWindow
- // Set the speed of your speedyTurtle to the fastest possible
- // Have your speedyTurtle draw a triangle with 100 pixel sides
- // ------------- End of makeSpeedyTurtle --#1.1
+ makeSpeedyTurtle();
// makeSlowTurtle (recipe below) --#4.0
- // ------------- Recipe for makeSlowTurtle --#3.0
- // Create a new slowTurtle instance
- // Add your slowTurtle to your MultiTurtleWindow
- // Have your slowTurtle draw a upside down triangle with 50 pixel sides
- // ------------- End of makeSlowTurtle --#3.1
+ makeSlowTurtle();
// makeCrazyTurtle (recipe below) --#6.0
// ------------- Recipe for makeCrazyTurtle --#5.1
// Create a new crazyTurtle instance
+ Turtle crazyTurtle = new Turtle();
// Add your crazyTurtle to your MultiTurtleWindow
+ mtw.addAndShowTurtle(crazyTurtle);
// Have your crazyTurtle draw a 55 pixel long lightning bolt
+ crazyTurtle.drawLightning(55);
// ------------- End of makeCrazyTurtle --#5.2
}
+ private void makeSlowTurtle()
+ {
+ // ------------- Recipe for makeSlowTurtle --#3.0
+ // Create a new slowTurtle instance
+ Turtle slowTurtle = new Turtle();
+ // Add your slowTurtle to your MultiTurtleWindow
+ mtw.addAndShowTurtle(slowTurtle);
+ // Have your slowTurtle draw a upside down triangle with 50 pixel sides
+ slowTurtle.drawTriangle(-50);
+ // ------------- End of makeSlowTurtle --#3.1
+ }
+ private void makeSpeedyTurtle()
+ {
+ // ------------- Recipe for makeSpeedyTurtle --#1.0
+ // Create a new speedyTurtle instance
+ Turtle speedyTurtle = new Turtle();
+ // Add your speedyTurtle to your MultiTurtleWindow
+ mtw.addAndShowTurtle(speedyTurtle);
+ // Set the speed of your speedyTurtle to the fastest possible
+ speedyTurtle.setSpeed(10);
+ // Have your speedyTurtle draw a triangle with 100 pixel sides
+ speedyTurtle.drawTriangle(100);
+ // ------------- End of makeSpeedyTurtle --#1.1
+ new Sound(Sound.TKPSound.Applause);
+ speedyTurtle.speak();
+ }
}
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/ConnectTheDots.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/ConnectTheDots.java
index 67d7f371..a6493f16 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/ConnectTheDots.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/ConnectTheDots.java
@@ -1,10 +1,13 @@
package org.teachingkidsprogramming.section08events;
+import org.teachingextensions.approvals.lite.util.NumberUtils;
import org.teachingextensions.logo.Tortoise;
import org.teachingextensions.logo.utils.ColorUtils.ColorWheel;
import org.teachingextensions.logo.utils.ColorUtils.PenColors;
import org.teachingextensions.logo.utils.EventUtils.MouseLeftClickListener;
import org.teachingextensions.logo.utils.EventUtils.MouseRightClickListener;
+import org.teachingextensions.logo.utils.LineAndShapeUtils.Circle;
+import org.teachingextensions.logo.utils.LineAndShapeUtils.Text;
public class ConnectTheDots implements MouseRightClickListener, MouseLeftClickListener
{
@@ -17,29 +20,47 @@ public ConnectTheDots()
setUpTheWindow();
prepareColorPalette();
// Listen for left clicks on the window for the tortoise --#1
+ Tortoise.getBackgroundWindow().addMouseLeftClickListener(this);
// Listen for right clicks on the window for the tortoise --#20.2
+ Tortoise.getBackgroundWindow().addMouseRightClickListener(this);
}
@Override
public void onLeftMouseClick(int x, int y)
{
// addDot at x and y (recipe below) --#5
+ addDot(x, y);
+ // Uncomment to write the text "Right click to clear the window" on the screen at position 100, 100 --#8
+ new Text("Right click to clear the window").setTopLeft(100, 100).addTo(Tortoise.getBackgroundWindow());
+ }
+ private void addDot(int x, int y)
+ {
// ------------- Recipe for addDot --#6
// createCircle at x and y (recipe below) --#2
+ createCircle(x, y);
+ // Move the tortoise to the current position of the mouse (x,y) --#4
+ Tortoise.moveTo(x, y);
+ // ------------- End of addDot Recipe
+ }
+ private void createCircle(int x, int y)
+ {
// ------------- Recipe for createCircle --#3.0 (everything in this recipe)
+ int number = NumberUtils.getRandomInt(7, 17);
// Create a new circle with a radius of 11 using the next color on the color wheel
+ Circle circle = new Circle(number, ColorWheel.getNextColor());
// Change the circle to be 60% opaque
+ circle.setTransparency(40);
// Move the circle so that it's center is at the current position of the mouse (x,y)
+ circle.setCenter(x, y);
// Place the circle on the tortoise's window
+ circle.addTo(Tortoise.getBackgroundWindow());
// ------------- End of createCircle Recipe --#3.1
- // Move the tortoise to the current position of the mouse (x,y) --#4
- // ------------- End of addDot Recipe
- // Uncomment to write the text "Right click to clear the window" on the screen at position 100, 100 --#8
- // new Text("Right click to clear the window").setTopLeft(100, 100).addTo(Tortoise.getBackgroundWindow());
+ Tortoise.setPenColor(ColorWheel.getRandomColorFromWheel());
}
@Override
public void onRightMouseClick(int x, int y)
{
// Clear everything from the window HINT: Use Tortoise --#7
+ Tortoise.clear();
}
private static void prepareColorPalette()
{
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubble.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubble.java
index 5742a749..223c7abd 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubble.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubble.java
@@ -1,34 +1,60 @@
package org.teachingkidsprogramming.section08events;
+import org.teachingextensions.WindowUtils.ProgramWindow;
+import org.teachingextensions.approvals.lite.util.NumberUtils;
+import org.teachingextensions.logo.utils.ColorUtils.ColorWheel;
+import org.teachingextensions.logo.utils.ColorUtils.PenColors.Blues;
+import org.teachingextensions.logo.utils.ColorUtils.PenColors.Purples;
import org.teachingextensions.logo.utils.EventUtils.MouseLeftClickListener;
+import org.teachingextensions.logo.utils.LineAndShapeUtils.Circle;
public class SimpleBubble implements MouseLeftClickListener
{
+ private ProgramWindow programWindow;
public SimpleBubble()
{
// Create a ProgramWindow titled My Bubble --#1.1
+ programWindow = new ProgramWindow("My Bubble");
// Uncomment the line below -- #1.2
- // programWindow.setWindowVisible(true);
+ programWindow.setWindowVisible(true);
// Have SimpleBubble listen for when the left mouse button is clicked in your program window --#2.2
+ programWindow.addMouseLeftClickListener(this);
// prepareColorPalette (recipe below) --#7.1
//
+ prepareColorPalette();
+ }
+ private void prepareColorPalette()
+ {
// ------------- Recipe for prepareColorPalette --#7.2
// Add purple to the color wheel --#2.3
+ ColorWheel.addColor(Purples.Purple);
// Add light steel blue to the color wheel --#4
+ ColorWheel.addColor(Blues.SteelBlue);
// Add blue to the color wheel --#5
+ ColorWheel.addColor(Blues.Blue);
// Add dark blue to the color wheel --#6
+ ColorWheel.addColor(Blues.DarkBlue);
// ------------- End of prepareColorPalette recipe --#7.3
}
@Override
public void onLeftMouseClick(int x, int y)
{
// createBubble (recipe below) --#8.1
+ createBubble(x, y);
+ }
+ private void createBubble(int x, int y)
+ {
// ------------- Recipe for createBubble --#8.2
// Remove previous bubbles from your program window --#9
+ programWindow.clearWindow();
// Set the radius for the circle to a random number between 10 and 50 --#2.5
+ int radius = NumberUtils.getRandomInt(10, 50);
// Create a circle with the radius and the next color from the color wheel --#2.1
+ Circle circle = new Circle(radius, ColorWheel.getNextColor());
// Move the center of the bubble to the current position of the mouse on the window --#3
+ circle.setCenter(x, y);
// Add the circle to your program window --#2.4
+ circle.addTo(programWindow);
// ------------- End of createBubble recipe --#8.3
}
public static void main(String[] args)
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubbleQuiz.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubbleQuiz.java
index 35b8ceda..790d6a53 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubbleQuiz.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubbleQuiz.java
@@ -2,6 +2,7 @@
import org.teachingextensions.logo.Tortoise;
import org.teachingextensions.logo.utils.ColorUtils.PenColors;
+import org.teachingextensions.logo.utils.ColorUtils.PenColors.Greens;
import org.teachingextensions.logo.utils.EventUtils.MouseLeftClickListener;
import org.teachingextensions.logo.utils.EventUtils.MouseRightClickListener;
import org.teachingextensions.logo.utils.LineAndShapeUtils.Text;
@@ -17,23 +18,28 @@ public class SimpleBubbleQuiz extends SimpleBubbleQuizAdapter
public void question1()
{
//code: In the Tortoise background window, have this quiz listen for when the left mouse button is clicked
+ Tortoise.getBackgroundWindow().addMouseLeftClickListener(this);
//action: YOU must left click on the first base to pass this question
}
@Override
public void question2()
{
//code: Write "Single!" on the screen in yellow at position 155,135
+ new Text("Single!").setPenColor(PenColors.Yellows.Yellow).setTopLeft(155, 135)
+ .addTo(Tortoise.getBackgroundWindow());
}
@Override
public void question3()
{
- //code: In the Tortoise background window, have this quiz listen for when the right mouse button is clicked
+ //code: In the Tortoise background window, have this quiz listen for when the right mouse button is clicked
+ Tortoise.getBackgroundWindow().addMouseRightClickListener(this);
//action: YOU must right click on the home plate (4th base) to pass this question
}
@Override
public void question4()
{
//code: Write "Home Run!" on the screen in lime green at position 105,235
+ new Text("Home Run!").setPenColor(Greens.LimeGreen).setTopLeft(105, 235).addTo(Tortoise.getBackgroundWindow());
}
public static void main(String[] args)
{
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzz.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzz.java
index 4ef00217..7d9c91d6 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzz.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzz.java
@@ -2,14 +2,24 @@
public class FizzBuzz
{
- // For the whole numbers from 1 to 100, print either that number, or,
- // If that number is evenly divisible by 3, then print the word 'Fizz',
- // If that number is evenly divisible by 5, then print the word 'Buzz',
- // If that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz'
- //
- // NOTE: this is a kata (higher level instructions)
- // part of the exercise is to translate into line-by-line English, THEN Java
- //
- // For more complete directions see this page
- // https://www.penflip.com/lynnlangit/tkp-lesson-plans/blob/master/course09.txt
+ public static void main(String[] args)
+ {
+ StringBuilder sb = new StringBuilder();
+ // For the whole numbers from 1 to 100, print either that number, or,
+ for (int i = 1; i < 101; i++)
+ {
+ sb.append(convert(i));
+ }
+ System.out.print(sb);
+ }
+ public static String convert(int i)
+ {
+ // If that number is divisible by 3 and 5, then print the word 'FizzBuzz'
+ if (0 == i % 15) { return "\n FizzBuzz"; }
+ // If that number is divisible by 5, then print the word 'Buzz',
+ if (0 == i % 5) { return "\n Buzz"; }
+ // If that number is divisible by 3, then print the word 'Fizz',
+ if (0 == i % 3) { return "\n Fizz"; }
+ return "\n " + i;
+ }
}
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzzTDD.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzzTDD.java
index dcc18b0b..470e8274 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzzTDD.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzzTDD.java
@@ -1,14 +1,28 @@
package org.teachingkidsprogramming.section09final;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
public class FizzBuzzTDD
{
- // For the numbers being tested, print out either that number, or,
- // If that number is evenly divisible by 3, then print the word 'Fizz',
- // If that number is evenly divisible by 5, then print the word 'Buzz',
- // If that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz'
- //
- // Write tests using the Assert object via the TDD style
- //
- // For more complete directions see this page
- // https://www.penflip.com/lynnlangit/tkp-lesson-plans/blob/master/course09.txt
-}
+ public static String convert(int i)
+ {
+ if (0 == i % 15) { return "FizzBuzz"; }
+ if (0 == i % 5) { return "Buzz"; }
+ if (0 == i % 3) { return "Fizz"; }
+ return "" + i;
+ }
+ @Test
+ public void test1Returns1()
+ {
+ String result = FizzBuzzTDD.convert(1);
+ assertEquals("1", result);
+ }
+ @Test
+ public void test2Returns2()
+ {
+ String result = FizzBuzzTDD.convert(2);
+ assertEquals("2", result);
+ }
+}
\ No newline at end of file
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/RectangleKata.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/RectangleKata.java
index ea22501e..55d663cd 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/RectangleKata.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/RectangleKata.java
@@ -1,11 +1,18 @@
package org.teachingkidsprogramming.section09final;
+import org.teachingextensions.logo.Tortoise;
+import org.teachingextensions.logo.utils.ColorUtils.PenColors.Reds;
+
public class RectangleKata
{
public static void main(String[] args)
{
// Draw a rectangle
// Write the steps to code your rectangle out in English
+ // Show the tortoise #1
+ Tortoise.show();
+ // Draw one shape that is x by y pixels wide #2
+ Tortoise.drawShape(1, Reds.Red, 150, 300);
// Translate from English to Java one line at a time
// Run your code after each line of Java to make sure it works as expected
}
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/SimplePuzzle.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/SimplePuzzle.java
index 1327c827..78cf8933 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/SimplePuzzle.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/SimplePuzzle.java
@@ -7,10 +7,14 @@
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
+import org.teachingextensions.logo.utils.EventUtils.MessageBox;
+import org.teachingextensions.logo.utils.PuzzleUtils.AStarPlayer;
import org.teachingextensions.logo.utils.PuzzleUtils.Puzzle;
import org.teachingextensions.logo.utils.PuzzleUtils.PuzzleAnimation;
import org.teachingextensions.logo.utils.PuzzleUtils.PuzzleBoard;
+import org.teachingextensions.logo.utils.PuzzleUtils.PuzzlePlayer;
import org.teachingextensions.logo.utils.PuzzleUtils.PuzzleState;
+import org.teachingextensions.logo.utils.PuzzleUtils.PuzzleWindow;
public class SimplePuzzle implements Runnable
{
@@ -43,30 +47,46 @@ public void run()
this.setLookAndFeel();
PuzzleState solution = null;
// Do this until the player finds a solution --#6.1
- // Create a Message Box that shows the message "Looking for puzzle solution..." --#4
//
- // Try to solve the puzzle --#5.1
- // Create an array of integers named 'shuffled' which shuffles the cell array --#2.1
- // Run the new puzzle (uses the cells array), Then update it to use the shuffled array --#2.2
- //
- puzzle = new Puzzle(cells);
- //
- // Create a new AStarPlayer named player (of type PuzzlePlayer) which uses the current puzzle -- #3.1
- // NOTE for teacher - have kids run it multiple times here to see that sometimes it fails
- // Create a solution (of type PuzzleState) by telling the player to solve it (TIP: Not all puzzles can be solved!) --#3.2
- //
- PuzzleBoard board = new PuzzleBoard(puzzle, solution);
- //
- // Create a new Puzzle Window that takes a parameter named board -- #1.1
- //
- new Thread(new PuzzleAnimation(board)).start();
- // Set the current puzzle window visibility to be true --#1.2
- //
- // End of try --#5.2
- // Create a Message Box that shows the message "This puzzle is not solvable, click ok to try again" --#5.4
+ do
+ {
+ // Create a Message Box that shows the message "Looking for puzzle solution..." --#4
+ MessageBox.showMessage("Looking for puzzle solution...");
+ // Try to solve the puzzle --#5.1
+ try
+ {
+ // Create an array of integers named 'shuffled' which shuffles the cell array --#2.1
+ int[] shuffled = shuffled(cells);
+ // Run the new puzzle (uses the cells array), Then update it to use the shuffled array --#2.2 //
+ puzzle = new Puzzle(shuffled);
+ //
+ // Create a new AStarPlayer named player (of type PuzzlePlayer) which uses the current puzzle -- #3.1
+ PuzzlePlayer player = new AStarPlayer(puzzle);
+ // NOTE for teacher - have kids run it multiple times here to see that sometimes it fails
+ // Create a solution (of type PuzzleState) by telling the player to solve it (TIP: Not all puzzles can be solved!) --#3.2
+ solution = player.solve();
+ //
+ PuzzleBoard board = new PuzzleBoard(puzzle, solution);
+ //
+ // Create a new Puzzle Window that takes a parameter named board -- #1.1
+ PuzzleWindow pw = new PuzzleWindow(board);
+ //
+ new Thread(new PuzzleAnimation(board)).start();
+ // Set the current puzzle window visibility to be true --#1.2
+ pw.setWindowVisible(true);
+ //
+ // End of try --#5.2
+ }
+ catch (IllegalStateException e)
+ // Create a Message Box that shows the message "This puzzle is not solvable, click ok to try again" --#5.4
+ {
+ MessageBox.showMessage("This puzzle is not solvable, click ok to try again");
+ }
+ }
// End of catch --#5.3
//
// End of while --#6.2
+ while (solution == null || !solution.isSolution());
}
//
private void setLookAndFeel()
diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/WheelKata.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/WheelKata.java
index 36bdf676..be476224 100644
--- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/WheelKata.java
+++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/WheelKata.java
@@ -1,9 +1,31 @@
package org.teachingkidsprogramming.section09final;
+import org.teachingextensions.logo.Tortoise;
+
public class WheelKata
{
- // Draw a wheel
- // Write the steps to code your wheel out in English
- // Translate from English to Java one line at a time
- // Run your code after each line of Java to make sure it works as expected
-}
+ public static void main(String[] args)
+ {
+ // Draw a wheel
+ // Write the steps to code your wheel out in English
+ // Show the tortoise #1
+ Tortoise.show();
+ // set the tortoise speed to full #2
+ Tortoise.setSpeed(10);
+ // Do the following 100 times #3.1
+ for (int i = 0; i < 100; i++)
+ {
+ // move tortoise 15 pixels #4
+ Tortoise.move(15);
+ // turn tortoise 90 degrees to the right #5
+ Tortoise.turn(90);
+ // move the tortoise 90 pixels #6
+ Tortoise.move(90);
+ // turn the tortoise 105 degrees #7
+ Tortoise.turn(105);
+ // Repeat #3.2
+ }
+ // Translate from English to Java one line at a time
+ // Run your code after each line of Java to make sure it works as expected
+ }
+}
\ No newline at end of file