TURTLE GRAPHICS SOURCE CODE
Back to Turtle Graphics

Turtle Procedures Observer Procedures

to go1
if who < 10
[rt 1
hatch [setc who / 30
repeat 36 [fd 4 rt 10]
die]]
end

to go2
if who < 20
[ifelse (who mod 2) = 0
[rt 1
hatch [setc who / 20
repeat 36 [fd 4 rt 10]
die]]
[lt 1
hatch [setc who / 20
repeat 36 [fd 4 lt 10]
die]]]
end

to go3
if who < 10
[rt 1
hatch [setc 100 + (who / 30)
repeat 36 [fd 4 rt 10]
die]]
end

to go4
if who < 40
[ifelse (who mod 2) = 0
[rt 2 fd 1
hatch [setc 100 + (who / 50)
repeat 20 [fd 1 rt 10]
die]]
[lt 2 fd 1
hatch [setc 100 + (who / 50)
repeat 20 [fd 1 lt 10]
die]]]
end

to go5
fd 1 rt 2
end

to tfd :n
repeat :n [hatch [setc who seth ycor * 3] fd 1]
end

to go6
fd 4 rt 10
end



to setup1
ca
crt 10
ask-turtles [pd]
end

to setup2
ca
crt 20
ask-turtles [pd]
end

to setup3
ca
crt 10
end

to setup4
ca
crt 20
ask-turtles
   [fd 30
     rt 180]
crt 20
ask-turtles [fd 10]
end

to setup5
ca
crt 720
ask-turtles
   [fd 20
    repeat who [fd 1 rt 2]
    setc who]
end

to setup6
ca
crt 1
ask-turtles
   [rt 15
     repeat 6 [repeat 36 [tfd 3 rt 10] rt 60]]
end