Created
May 21, 2012 06:44
-
-
Save kthoms/2760868 to your computer and use it in GitHub Desktop.
Solution for Geocache GC291W9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import ch.aplu.turtle.Turtle; | |
import ch.aplu.turtle.TurtleFrame; | |
/** | |
* see http://www.aplu.ch/home/apluhomex.jsp?site=65 | |
* download Jar from http://www.aplu.ch/home/download/aplujar5.zip | |
* see http://www.geocaching.com/seek/cache_details.aspx?guid=fb9e65c2-aa9e-4848-9786-899d6eed9ca9 | |
*/ | |
public class GC291W9 { | |
Turtle _t; | |
public static void main(String[] args) { | |
new GC291W9(); | |
} | |
public GC291W9 () { | |
_t = new Turtle(new TurtleFrame("GC291W9", 1000, 500)); | |
_t.home(); | |
_t.clean(); | |
_t.penUp(); | |
run(); | |
} | |
public void lf (int x) { | |
_t.left(90); | |
_t.forward(x); | |
} | |
public void rf (int x) { | |
_t.right(90); | |
_t.forward(x); | |
} | |
public void g () { | |
_t.penDown(); | |
for (int i=0; i<9; i++) { | |
_t.forward(5); | |
_t.right(40); | |
} | |
_t.penUp(); | |
} | |
public void d () { | |
_t.penDown(); | |
_t.forward(50); | |
rf(50); | |
rf(50); | |
_t.back(50); | |
lf(50); | |
rf(50); | |
_t.penUp(); | |
rf(100); | |
rf(50); | |
} | |
public void a () { | |
d(); | |
_t.penDown(); | |
_t.left(180); | |
_t.forward(50); | |
lf(100); | |
_t.penUp(); | |
lf(50); | |
lf(100); | |
_t.right(90); | |
} | |
public void v () { | |
_t.penDown(); | |
rf(50); | |
lf(50); | |
rf(50); | |
_t.left(180); | |
_t.forward(100); | |
_t.penUp(); | |
_t.right(90); | |
} | |
public void o () { | |
_t.penDown(); | |
rf(100); | |
_t.penUp(); | |
_t.right(180); | |
_t.forward(100); | |
_t.right(90); | |
} | |
public void n () { | |
d(); | |
_t.right(180); | |
_t.forward(50); | |
_t.penDown(); | |
lf(50); | |
_t.penUp(); | |
lf(50); | |
lf(50); | |
_t.right(90); | |
} | |
public void s () { | |
_t.penDown(); | |
_t.forward(50); | |
_t.right(110); | |
_t.forward(100); | |
_t.back(50); | |
_t.right(70); | |
_t.forward(15); | |
_t.back(30); | |
_t.penUp(); | |
_t.forward(15); | |
_t.left(70); | |
_t.back(50); | |
_t.left(110); | |
} | |
public void dt () { | |
rf(100); | |
_t.penDown(); | |
for (int i=0; i<5; i++) { | |
lf(2); | |
} | |
_t.penUp(); | |
lf(100); | |
_t.right(90); | |
} | |
public void run () { | |
_t.forward(130); | |
_t.left(90); | |
_t.forward(250); | |
_t.right(90); | |
_t.penDown(); | |
for (int i=0; i<3; i++) { | |
lf(50); | |
} | |
rf(50); | |
rf(50); | |
_t.penUp(); | |
rf(100); | |
rf(50); | |
_t.forward(20); | |
o(); | |
_t.forward(20); | |
g(); | |
_t.forward(20); | |
d(); | |
_t.forward(20); | |
o(); | |
_t.forward(20); | |
dt(); | |
_t.forward(20); | |
a(); | |
_t.forward(20); | |
d(); | |
_t.forward(20); | |
n(); | |
_t.right(180); | |
_t.forward(400); | |
lf(130); | |
_t.left(90); | |
s(); | |
_t.forward(20); | |
g(); | |
_t.forward(20); | |
d(); | |
_t.forward(20); | |
d(); | |
_t.forward(20); | |
dt(); | |
_t.forward(20); | |
v(); | |
_t.forward(20); | |
v(); | |
_t.forward(20); | |
a(); | |
_t.forward(100); | |
rf(50); | |
_t.left(180); | |
_t.penDown(); | |
_t.left(20); | |
for (int i=0; i<32; i++) { | |
_t.forward(5); | |
_t.left(10); | |
} | |
_t.right(10); | |
lf(44); | |
_t.back(18); | |
rf(18); | |
_t.back(36); | |
_t.penUp(); | |
_t.forward(75); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment