Java:
package Kara;
import java.awt.Color;
import ch.aplu.turtle.Turtle;
import ch.aplu.util.Console;
public class John {
public static void main(String[] args) {
Turtle john = new Turtle(); //Ich erstelle das Objekt john
Console console = new Console();
john.setColor(Color.BLACK);
john.setPenColor(Color.BLACK);
john.setFontSize(20);
john.speed(1000);
boolean wichway=false;
String richtung;
double steps;//Vergroeßerungsabstand
double schrittweite = 0;
int loops;
int counter;
int auswahl=1;
int x;
int y;
double xD;
double yD;
console.print("Welche Richtung wollen sie laufen l(links) oder r(rechts)? ");
richtung = console.readLine();
console.print("Wie viel Windungen? ");
loops = console.readInt();
console.print("Wie gross soll der Vergroesserungsabstand sein? ");
steps = console.readDouble();
counter=loops *4;
schrittweite = steps;
for(int n=0;n<counter;n++){
john.forward(schrittweite);
if(richtung=="l"){
john.left(90);
}else {
john.right(90);
}
xD=john.getX();
yD=john.getY();
x = (int) xD;
y = (int) yD;
if(auswahl==1){
john.setPenColor(Color.RED);
john.setColor(Color.RED);
auswahl=2;
}else if(auswahl==2){
john.setPenColor(Color.GREEN);
john.setColor(Color.GREEN);
auswahl=3;
}else if(auswahl==3){
john.setPenColor(Color.BLUE);
john.setColor(Color.BLUE);
auswahl=0;
}else if(auswahl==0){
john.setPenColor(Color.BLACK);
john.setColor(Color.BLACK);
auswahl=1;
john.label(x + "/" + y);
}
schrittweite= schrittweite+ steps;
}//end for-Schleife
}//end main
}//end class