Using a Cone to Simulate Turtles (or flocking birds, aka the Boids) seeing things ahead of them.
Tuesday, December 8th, 2009

The applet requires Java 1.4.1 or higher. It will not run on Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use a browser that supports Java 1.4. (Safari works, IE does not. Mac OS X comes with Safari. Open Safari and set it as your default web browser under Safari/Preferences/General.) On other operating systems, you may obtain the latest Java plugin from Sun's Java site.


In order for this to work, this file, your model file (SeeingCone.nlogo), and the file NetLogoLite.jar must all be in the same directory. (You can copy NetLogoLite.jar from the directory where you installed NetLogo.)

view/download NetLogo model file: SeeingCone.nlogo

powered by NetLogo

WHAT IS IT?

How would you modify the FLOCKING model so that the flocking birds only
are effected by the closest bird it sees in front of it, since real birds
do NOT have eyes in the back of their head?

Use the IN-CONE primitive that NetLogo provides. The CONE is out in front
of the turtle agent. Front is determined by the heading of the turtle,
i.e. the direction that it is facing.
Here is the NetLogo help on the IN-CONE primitive:

in-cone reports an agentset that includes only those agents from the
original agentset that fall in the cone. (This can include the calling
agent itself.)

The distance to a patch is measured from the center of the patch.

ask turtles
[ ask patches in-cone 3 60
[ set pcolor red ] ]
;; each turtle makes a red "splotch" of patches in a 60 degree
;; cone of radius 3 ahead of itself


HOW IT WORKS

Try it out with 4 and 8 and 12 and 16 turtles.
Try it out with 0.1 second delay, 0.2 second delay
and with the default 2 second delay.


HOW TO USE IT

Study the NetLogo code.


THINGS TO TRY

Try to apply the idea to the Flocking model. The "birds" in the Flocking NetLogo model have eyes in the back and the side of their head, so they "SEE" birds that are behind them. A more realistic model would have them seeing only directly ahead for a certain distance and cone angle.

What if you try to use the FOREACH and a double list.

List 1 would have the radius values such as [10 9 8 7 6 5 4 3 2 1]

List 2 would have either the colors such as [5 15 25 35 45 55 65 75 85 96]
or else List 2 could have angles instead of colors.


EXTENDING THE MODEL

Could these techniques be extended to Predator/Prey models? When certain predators are hungry but not starving, their senses are keener, sharper, more powerful. How would you model something like that so each agent's in-cone radius and angle would increase when the need for hunting prey was the greatest?

Differences. What if there were random variation among the predators in levels of vision using IN-CONE? Would it be possible to simulate survival of the fittest in terms of that advantage?