procedures for TURTLECHASE
The turtlechase procedures were developed by
to setup
Wendy Petti
Founder of Math Cats
wpetti@mathcats.com
and may be used with this acknowledgement.
You will need:
5 turtles
two buttons labelled "setup" and "chase"
one slider labelled "howfar?"
* * * * * * * * * *
clean
everyone [pu]
t1, setx howfar? sety howfar? setpensize 2
t2, setx howfar? sety 0 - howfar? setpensize 2
t3, setx 0 - howfar? sety 0 - howfar? setpensize 2
t4, setx 0 - howfar? sety howfar? setpensize 2
t5, setx howfar? sety howfar? setc 11 everyone [pd]
t1, towards "t4
t2, towards "t1
t3, towards "t2
t4, towards "t3
everyone [st]
t5, ht make "travel 0
end
to chase
t5, pu towards "t4 fd distance "t4 pd
forever [startchase]
end
to startchase
t1, towards "t4 fd 1
t2, towards "t1 fd 1
t3, towards "t2 fd 1
t4, towards "t3 fd 1
t5, towards "t4 fd distance "t4
towards "t3 fd distance "t3
towards "t2 fd distance "t2
towards "t1 fd distance "t1
setc color + 1
make "travel :travel + 1
if :travel > 2 * howfar? [everyone [ht] stopall ]
end
to startup
setup
end
copyright 2000 -
by Wendy Petti of Math Cats. All Rights Reserved.