Skip to content
Merged
Show file tree
Hide file tree
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,16 +1,22 @@
package org.teachingkidsprogramming.recipes;

import org.teachingextensions.logo.Colors;
import org.teachingextensions.logo.Tortoise;
import org.teachingextensions.windows.MessageBox;

public class SimpleSquare
{
public static void main(String[] args) throws Exception
{
// Show the tortoise --#1
// Make the tortoise move as fast as possible --#6
// Do the following 4 times --#5.1
// Change the color of the line the tortoise draws to "blue" --#4
// Move the tortoise 50 pixels --#2
// Turn the tortoise to the right (90 degrees) --#3
// Repeat --#5.2
Tortoise.show();
Tortoise.setSpeed(10);
int sides = MessageBox.askForNumericalInput("How many sides?");
for (int i = 1; i <= sides; i++)
{
Tortoise.setPenColor(Colors.getRandomColor());
Tortoise.setPenWidth(i * 3.5);
Tortoise.move(i * 5);
Tortoise.turn(-360.0 * 3 / sides);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
package org.teachingkidsprogramming.recipes;

import org.teachingextensions.logo.ColorWheel;
import org.teachingextensions.logo.Colors;
import org.teachingextensions.logo.Tortoise;

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 --#6
// Add Violet to the Color Wheel --#8
// Add Purple to the Color Wheel --#9
Tortoise.show();
Tortoise.setSpeed(10);
ColorWheel.addColor(Colors.Purples.BlueViolet);
ColorWheel.addColor(Colors.Purples.Violet);
ColorWheel.addColor(Colors.Purples.Purple);
for (int i = 1; i <= 75; i++);
{
}
// Do the following 75 times --#3
// Change the color of the line the tortoise draws the next color on the Color Wheel --#7
// Move the tortoise 5 times the current line number you are drawing --#5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
package org.teachingkidsprogramming.recipes.quizzes;

import org.teachingextensions.logo.Colors;
import org.teachingextensions.logo.Tortoise;
import org.teachingkidsprogramming.recipes.quizzes.graders.SimpleSquareQuizGrader;
import org.teachingkidsprogramming.recipes.quizzes.graders.SquareQuiz;

public class SimpleSquareQuiz implements SquareQuiz
{
public void question1()
{
// Turn the tortoise 1/5 of 360 degrees to the right
Tortoise.turn(360.0 / 5);
}
public void question2()
{
// Move the tortoise 110 pixels
Tortoise.move(110);
}
public void question3()
{
// Change the color the tortoise draws to yellow
Tortoise.setPenColor(Colors.Yellows.Yellow);
}
public void question4()
{
// Change the width of the line the tortoise draws to 5 pixels
Tortoise.setPenWidth(5);
}
public static void main(String[] args)
{
Expand Down