diff --git a/projects/Turtle/MyProgram.java b/projects/Turtle/MyProgram.java index 9470e87..6b94b77 100644 --- a/projects/Turtle/MyProgram.java +++ b/projects/Turtle/MyProgram.java @@ -8,7 +8,9 @@ public static void main(String[] args) { // import turtle.Turtle; Turtle turtle = new Turtle(); turtle.penColor("red"); - //draw your first initial + turtle.hide(); + + // draw your first initial turtle.towards(10, 10); turtle.backward(25); turtle.right(90); @@ -20,7 +22,7 @@ public static void main(String[] args) { turtle.right(90); turtle.forward(25); - //draw a 5 pointed star + // draw a 5 pointed star turtle.up(); turtle.forward(100); @@ -32,26 +34,51 @@ public static void main(String[] args) { turtle.backward(50); turtle.up(); } - //draw a flower + // draw a flower turtle.home(); turtle.up(); turtle.left(90); - turtle.forward(100); - turtle.down(); turtle.forward(50); + turtle.down(); + turtle.forward(150); int tilt = 0; for (int i = 0; i < 36; i++) { - turtle.penColor(Color.GREEN); + turtle.penColor(Color.YELLOW); turtle.forward(50); turtle.backward(50); turtle.right(10); tilt += 10; } - turtle.right(180); + turtle.right(180 * tilt); turtle.shapeSize(50, 50); turtle.penColor(Color.darkGray); - turtle.forward(100); - //Create something colorful - + // turtle.forward(100); + // Create something colorful + turtle.up(); + turtle.home(); + turtle.right(180); + turtle.forward(200); + turtle.down(); + for(int i = 0; i< 50; i++) { + for (int j = 0; j < 50; j++) { + float midd = (float) (i + j) / 100; + turtle.penColor(Color.getHSBColor((float) i / 5 , midd, (float) j / 20)); + turtle.setDirection(i * 8.5); + turtle.forward(10); + turtle.setDirection(j * 9); + turtle.forward(10); + turtle.setDirection((i + j) * 10); + turtle.forward(10); + turtle.setDirection((i - j) * 10); + turtle.forward(10); + } + } + turtle.show(); +turtle.up(); +turtle.home(); +turtle.down(); +while (1 != 0) { + turtle.right(10); +} } }