swarm-support
[Top][All Lists]
Advanced

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

Re: "zone" or "getZone"? and one additiona question.


From: glen e. p. ropella
Subject: Re: "zone" or "getZone"? and one additiona question.
Date: Mon, 17 Mar 1997 09:34:01 -0700

kcline> All that being said, I think this is a matter of personal
kcline> preference [no pun intended].

Just a couple of additional comments to Ken's....

1) the "getZone" function returns the same zone in which the object
recieving the message resides (correct me if I'm wrong).  So, the 
following code will put a new person in the same zone as the original
person (in, say, modelSwarm.m):

   newPerson = [Person create: [otherPerson getZone]];

The next code will place the new person as a kind of zone-sibling
to the modelSwarm:

   newPerson = [Person create: [self getZone]];

And this next code will place the new person in a zone that is
a zone-sibling of the modelSwarm:

   sibZone = [Zone create: [self getZone]];
   newPerson = [Person create: sibZone];

2) The one thing to remember is that we now have "Swarms-as-Zones" and
can actually use the Swarm, itself, as a Zone.  So, I would recommend
that the following code be used to place any new people inside the 
Swarm:

   newPerson = [Person create: self];

Then, since alot of the agents we define have a pointer back to the
Swarm of which they're a member, you can use the following type of
code to allocate new agents while inside the agent code (say, 
Person.m), itself:

   offspring = [Person create: swarmImIn];

And both you and your offspring will reside in the same Zone and
the same Swarm, by definition.  I think doing it this way will 
clear up some of the confusion.

glen


reply via email to

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