[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
DARREN MATTHEW SCHREIBER |
Date: |
Tue, 7 Sep 1999 12:41:34 -0700 (PDT) |
I am working on an algorithm that parses a list of agents and merges some
of them. Since I am removing some agents while the algorithm is looping,
I have been having trouble making sure that I don't go past the end of the
list (I solved this by changing to a do while loop) and checking each of
the agents. I was thinking of that one solution would be to put a
placeholder in the list that I could then remove once the algorithm had
run. Could I just put an integer there? How would I do that? I want to
avoid having to create a dummy object.
Here is what I am currently using:
i=0;
listLength=[availableList getCount];
do {
id newCoalition;
agent1=[availableList atOffset: i];
agent2=[agent1 getClosestNeighbor];
agent3=[agent2 getClosestNeighbor];
if (agent1==agent3) {
newCoalition=[self formNewCoalition: agent1 two: agent2];
[availableList atOffset: i put: newCoalition];
}
listLength=[availableList getCount];
i=i++;
} while (i<listLength)
Any ideas would be appreciated...
Darren
==================================
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.
- 4th Problem Installing Swarm2.0 in LinuxPPC R5, (continued)
- 4th Problem Installing Swarm2.0 in LinuxPPC R5, Darren Schreiber, 1999/09/06
- Re: 4th Problem Installing Swarm2.0 in LinuxPPC R5, Marcus G. Daniels, 1999/09/06
- Re: 4th Problem Installing Swarm2.0 in LinuxPPC R5, Darren Schreiber, 1999/09/07
- Using forEach:, Darren Schreiber, 1999/09/07
- Re: Using forEach:, Norberto Eiji Nawa(0.3.31), 1999/09/07
- Re: Using forEach:, Ken Cline, 1999/09/07
- Re: 4th Problem Installing Swarm2.0 in LinuxPPC R5, Marcus G. Daniels, 1999/09/07
- return type for a method parameter & assigning probe buttons, William S. Shu, 1999/09/07
- Re: return type for a method parameter & assigning probe buttons, Marcus G. Daniels, 1999/09/07
- Re: return type for a method parameter & assigning probe buttons, William S. Shu, 1999/09/07
- [no subject],
DARREN MATTHEW SCHREIBER <=
- Re: none, Marcus G. Daniels, 1999/09/07
- Dendogram, Darren Schreiber, 1999/09/08
- Re: Dendogram, Marcus G. Daniels, 1999/09/08
- Display direction, Jayshree Sarma, 1999/09/08
- Re: Display direction, Marcus G. Daniels, 1999/09/08
- Error Message - Swarm-1.4.1, Jayshree Sarma, 1999/09/09
- Re: Error Message - Swarm-1.4.1, Marcus G. Daniels, 1999/09/09
- Re: Error Message - Swarm-1.4.1, Jayshree Sarma, 1999/09/09
- Re: Error Message - Swarm-1.4.1, Paul E. Johnson, 1999/09/09
- Re: Error Message - Swarm-1.4.1, Alex Lancaster, 1999/09/10