Reactive-C
- Meije
The
Prey-Hunter Demo (January 98)
One considers nodes, called rooms
in which two kinds of agents, called preys
and hunters, interact. Basically, preys
run away when they detect hunters close to them and hunters pursue preys
and kill them when they can catch them. Preys are shown on screen as little
green circles and hunters are shown as red circles. They are created at
random positions by the user, by clicking on two buttons.
To avoid to be caught, preys can migrate to an other room, when they
are on the point to be killed. In their basic version, hunters do not have
the possibility to migrate; thus, preys have a chance to live for ever
by migrating to a room where there is no hunter in it. In their extended
version, hunters can also migrate and pursue preys over the network.
A more friendly version of preys exists: it this version a prey which
is threaten by a hunter shouts out to warn others preys against the hunter,
so that prejudiced preys can immediately migrate.
Rooms
There are two rooms named room0 and room1 which look
like this:

Objects are created at random positions, when clicking on the colored
buttons on the left:
-
a prey moves randomly when it is not
threaten, and it runs away when a hunter is about to kill it. Prey vivacity
is randomly defined at creation.
-
a hunter pursue preys; hunter vivacity
is randomly defined at creation. Note that hunter, as well as preys, have
only a limited visibility in the room.
-
a vulture eats prey cadavers created
when preys are killed. Initially, a vulture is blue; it must eat at least
three cadavers to become immortal (in this case, it turns to purple); otherwise,
after a while, it transforms itself into two preys.
-
a destroyer is a prey which launch
bombs (with color cyan) when threaten. Note that a destroyer can destroy
itself.
-
a tracer is a prey which continuously
produces lures; lures are considered as full preys by hunters; they vanish
from screen after a small delay.
-
a preyhunter is a hunter which is also
a prey, but which does not know that fact. Note that two preyhunters can
kill each other.
-
a food object has no behavior; it is
simply ate by eaters.
-
a eater is a prey which must eat five
food object to become a hunter. Note that a eater jumps directly on the
food when there is some.
The following objets have possibility to migrate from a room to the other:
-
a runaway is a prey which migrates
to the other room when threaten.
-
a transhunter is a hunter which migrates
to the other room when it does not see any prey in the current room. So,
transhunters can pursue runaway preys over the rooms, which is not possible
for standard hunters.
-
a friendprey is a runaway prey that
shouts when on the point to be killed to warn other friendpreys which can
then all migrate to the other room.
Finally, the quit button exits from
the demo.
Implementation
The demo is implemented with Reactive
Scripts which are commands describing actions to be executed at
some delimited instants, where some events may either be present or absent.
The Reactive Scripts interpreter used is rem-rsi-tk
(for remote reactive script interpreter on top of Tk), an implementation
of Reactive Scripts with Tcl/Tk as language of external statements and
expressions. This interpreter is implemented in Reactive-C and runs on
several Unix platforms. Reactive-C and Reactive Scripts are developed in
the RC project and are
free
software available on the Web.
Installation
First, the rem-rsi-tk interpreter must be installed. It
runs on sunos4, solaris, linux, dec-alpha, and hp Unix platforms. Click
here
to get it.
Second, the code
for the demo must be loaded. In the demo directory, there is a makefile
to help the user.
If you choose the simple demo, without
migration, just type make simple. It will launch the rsi-tk
interpreter which is not linked to the network. The file start
is automatically loaded and run.
For simplicity, in the demo with migrationwe
use two windows which are both on the same machine. First, run the
Reactive-C name server by make nameserver. Second,
type make room0 to get the first room. Finally, to get
the second room, type make room1 in the other window.
Please, feel free to send comments, criticisms, and/or suggestions
to Frederic.Boussinot@sophia.inria.fr