swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swarm-Support] Simulating Eating


From: Eliezer Gurarie
Subject: [Swarm-Support] Simulating Eating
Date: Tue, 01 Apr 2003 13:48:31 -0800
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.1) Gecko/20020826

Dear Swarm Support,

I am working on a Predator-Prey model in a Stream - using SimpleBug as a template - and am having technical/strategic difficulty having randomly moving Predators eat randomly moving Prey. Basically, if a Predator agent chooses to step into a space occupied by a Prey agent, the Prey agent needs to be removed. My main questions are: How can one kind of agent "detect" what kind of agent is occupying a neighboring grid? Can one agent remove another agent from it's list? Ideally, a single eating function within the [predator step] method would look like:
if( [world getObjectAtX: newX Y:newY]=="a prey"])
   {
       "remove the prey in that spot";
       [putSelfAtX: newX Y: newY];
   }

But since I don't know how to detect the "nature" of an occupied space (only whether it is occupied or not) I have to go through a whole rigamarole that tracks Prey locations with a "HasPrey" switch in the StreamSpace. The schedule looks like:

1) [prey step1] -> the Prey move randomly (for the moment avoiding predators by going into empty spaces) 2) [predator step1] -> the Predator selects a potential spot (newX, newY) to move to. those that choose empty spots move, those that choose spots with "HasPrey==1" turn on a FeedingEvent switch at that spot, i.e.: if ([stream getHasPreyAtX: newX Y: newY]==1) [stream putFeedingEvent: 1 atX: newX Y: newY] 2) [prey step2] -> all Prey in FeedingEvent spots are removed from the world
3) [predator step2] -> the Predators move into FeedingEvent spots

This seems inefficient and counter to the concept of "realistic," straightforward agent interactions without having to go through the Stream environment to effectuate interactions.

Any advice on simulating "eating" would be appreciated.


Thanks,

Elie Gurarie
Quantitative Ecology and Resource Management
University of Washington, Seattle



reply via email to

[Prev in Thread] Current Thread [Next in Thread]