swarm-support
[Top][All Lists]
Advanced

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

Re: Using collections


From: Ken Cline
Subject: Re: Using collections
Date: Thu, 23 Jan 1997 15:09:13 -0500 (EST)

Thanks Roger!

Actually you're describing what we are calling "patrol"
(movement) behavior, that is where the agent repeats a
closed path/cycle.  This differs only slightly from "goal"
behavior in which the agent stops when he/she/it reaches the
last goal and stays there wondering where to go next (unless
he/she/it detects another agent...).


Speaking of "more explanation of ... library interfaces"...

Another short question about using a collection:

I want to search a map for a particular key and return the
member with that key (all members of the map will be
unique).  I wasn't sure from the documentation whether

    [mapIndex setKey: aKey]

returns the member after the index is repositioned.

>From the source code it appears that it does.

Thanks,

Ken.


-------------------------------------
On Thu, 23 Jan 1997, Roger M. Burkhart wrote:

> > I started with just:
> > 
> >        if ( (next_goal = [goalIndex next]) != NULL )
> >           [self setGoal: next_goal];
> 
> If you want to reset the index to reprocess any new goals that show up,
> another option would be to reposition the index to the Start location:
> 
>         if ( (next_goal = [goalIndex next]) != NULL ) {
>           [self setGoal: next_goal];
>         } else {
>           [goalIndex setLoc: Start];
>         }
> 
> Then the next call, as long as no new goals show up, will merely hit the
> end and reset for processing again, but as soon as a new goal shows up,
> it will set that instead.
> 
> I agree with Glen that we need more explanation (if not justification) of
> rationale for the library interfaces, but especially I think what will be
> useful are examples of typical usage and common idioms.  Resetting an
> index to Start for purposes of reprocessing is one of these.  Indexes may
> be used to move and position freely anywhere through a collection at any
> time, forwards and backwards, at the beginning, end, or anywhere else.
> 
> Roger
> 

_________________________________________________________
Ken Cline                             address@hidden
SAIC                                 VOICE (410) 571-0413
Annapolis, MD                          FAX (301) 261-8427




reply via email to

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