This is a notebook of robots that implement the
Sieve of Erathosthenes. The best way to watch it to give the robot on page 2 a box with a
bird in it and press F8 to stop all robots. Then get in the helicopter, press F8 to start
them up again, and watch as first a house is built with a robot inside that gives a bird a
2, then 3, 4, 5 and so on. The bird takes it to her nest in a new house that has robots in
it that passes along only numbers divisible by 2. When a number passes through all the
existing houses then it is a prime and a new house is built filtering out numbers
divisible by it.
This is a notebook of robots that compute the
product of numbers from 1 to n in a recursive fashion. One of the built-in demos of
ToonTalk shows how to build an iterative factorial program. Those robots can be found in
the Examples notebook on page 6 of your main notebook. This one is fun to watch
from the outside. (Computer scientists should be able to recognize the stack from the
This computes the same values as the singly
recursive version above, but if you watch from the outside you'll see a tree of houses
grow and shrink. To see the pattern well, the size of the city should be at least twice
the factorial being computed. So the city should be 20 by 20 for the best viewing of the
factorial of 10 being computed.
This uses the behavior notebook below to make 4
movies. The first one just has 2 characters bouncing off the edges. The second adds
reversing on collision to the oval. The third one gives the oval the goal of moving to the
center and also imposes a speed limit on it. The fourth gives the square the behavior of
chasing the oval. It also gets a speed limit.
The chase movies were made by placing different
behaviors on the back of geometric shapes. These behaviors were built in ToonTalk. They
include drift towards a goal, bounce off edges, obey speed limit, chase another, and more
and can be found in this notebook. There are plenty more
where they are called "anima-gadgets".
ToonTalk can send messages to Microsoft Window's
Media Control Interface (MCI). A cute example is Play Canyon
that has a picture of a switch. On the back is a robot who will play the file
"canyon.mid" from the Windows directory when the switch is on and it is on the
floor. (Note this example expects to find the file
c:/windows/media/town.mid and will fail
on Windows 2000 or NT 4, but it is not hard to edit to work.)
This was contributed
by Pierre-André Dreyfuss who
wrote the following. The team wants a box with two holes. An expression in the left one
and a bird for the answer in the right one. An operation is a box with three holes. In the
middle one of the operators + - x / on a word pad. Left and right : a number. An
expression is a three holes box, with an operator in the middle and both sides either a
number, or an operation, or an expression. The four first robots are computing operation.
The last three are dealing with expressions, in the left hole, in the right hole and
both sides, calling themselves recursively using the main book and
the 'oper' label for search.