[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swarm-Support] setting flags for agents
From: |
Glen E. P. Ropella |
Subject: |
Re: [Swarm-Support] setting flags for agents |
Date: |
Mon, 25 Jun 2007 20:43:15 -0700 |
User-agent: |
Icedove 1.5.0.12 (X11/20070607) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Steve Railsback wrote:
> address@hidden wrote:
>> I am trying to give agents memory of where they have walked. To do
>> this I am creating a flag in a class Cell (similar to HabitatCell in
>> StupidModel). Currently, all agents can set and get this flag by:
>>
>> Cell flags = (cell) cellWorld.getObjectAtX$Y(myX, myY);
>> flags.setFlag(num);
>> flags.getFlag(num);
>>
>> As each agent walks through the Grid2dImpl space they change the flag
>> from a 0 to one. The agents can then see where others have walked and
>> not walk on those spaces. I do not want this feature. I would like
>> the agents to set and get their own flags, which will allow them to
>> only see where they have walked. Any suggestions on how to do this
>> with Java Swarm 2.2.
>
> One alternative is for each agent to keep a list of cells it has been
> in, as its "memory". The agent can check whether it has been to some
> cell simply by whether its list of previously-visited cells contains
> that cell.
Another mechanism would be to give each agent an id (bit, integer,
string, real, object, whatever). At each grid point, place a list of
id's (or some other container object). When an agent walks over a spot
it deposits its id in that grid point. And when an agent looks at a
grid point, if it sees its id in the container, then it knows its been
there. It only has to recognize its own id.
cellWorld.getObjectAtX$Y(myX, myY).deposit(myID);
.
.
.
if ( ! cellWorld.getObjectAtX$Y(thatX, thatY).contains(myID) )
moveTo(thatX, thatY);
- --
glen e. p. ropella, 971-219-3846, http://tempusdictum.com
... given any rule, however "fundamental" or "necessary" for science,
there are always circumstances when it is advisable not only to ignore
the rule, but to adopt its opposite. -- Paul Feyerabend
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGgItTZeB+vOTnLkoRAqAXAKCzoq/Z4Hs2/sJmkKuJKHSLRxFuagCg1PhF
Qr7gNoYTaqKICk0oW3xbfSg=
=90zg
-----END PGP SIGNATURE-----