swarm-support
[Top][All Lists]
Advanced

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

Re: DblBuffer2d


From: Marcus G. Daniels
Subject: Re: DblBuffer2d
Date: 22 Dec 2000 18:48:59 -0800
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "DA" == David Aliaga <address@hidden> writes:

DA> what happen with the other positions? 

They'll be whatever was left from previous -putObject:atX:Y: messages
as of the last -updateLattice call.  That method is rotating the old
into the new lattice, so in order to keep some stable population, you
want to be sure that moving an object involves doing a putObject nil
in deserted locations.

DA> Should I put before (*) and (**) the following:
DA> [world fillWithObject: nil];

That would only make sense if on every step you are repopulating the space...

DA> 2)What happen if I have another agent let's say agent3 and I want
DA> to put it together with agent1 and agent2 but in a "random"
DA> position.(X,Y) (of course not (3,4) nor (4,8)) Then I have to make
DA> sure that and so I nead to "read" if there is an agent on position
DA> (X,Y) of "The future state of the world"!!!

DA> How can I read from newLattice?

DA> Of course another posibility is to put the 2 agents, update the
DA> Lattice, then check with the position of agent 3 and copy one and
DA> two and then 3 and update again, that means two updates per time
DA> step. Is this the way or there is a better one?

Right.  But hide that in a method so it is always done in the same way.
-updateLattice swaps pointers, so it is cheap.

Or you could subclass DblBuffer2d so that you can check the
writes for entries made since the last updateLattice.  

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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