[starlogo-users] patch and global variables...
toontalk at googlemail.com
Mon Mar 12 04:12:07 EDT 2007
Your patch variable example points to a shortcoming with the concept of
patches. If indeed only a few patches are poisoned then why not keep a
global variable listing the coordinates of the poisoned patches and check
for membership. The check may take a few extra nanoseconds but you don't
waste 10,000 memory locations.
I'm glad to hear that "Patches are a less active part of StarLogo TNG" since
I dislike the idea of having something that are really agents but they can't
move. It just complicates the computation model. There can be an efficiency
argument for low-level support of non-mobile agents but I think it is often
less efficient to support patches -- e.g. the poison example. Also it pushes
one's model towards a uniform rectangular grid while there are plenty of
other ways to model the environment. Maybe poison is spread out over circles
of radius 10 while other variables are at different patch sizes. Patches are
too special purpose to be part of a language.
On 11/03/07, Eric Klopfer <klopfer at mit.edu> wrote:
> Patches are a less active part of StarLogo TNG than they were in
> StarLogo 2. But the patches are an underlying grid on which the
> Agents walk. You can see the patches when the Agents walk around
> with their pens down and the different squares get colored. In
> addition to each patch being able to have a height and color (which
> the agents can change by stamping, stomping, yanking, etc.) the patch
> can also contain arbitrary variables defined by the user. So on the
> 100x100 grid there would be 10,000 copies of that variable.
> So one could define a "poison?" boolean variable for each patch and
> set it to true for a few patches (you'd have to create an agent to go
> to those patches and set that value). Then when an agent landed on a
> patch it could check to see if the poison? value were true and if so
> You are right on your guess for the right hand slot. It is supposed
> to be an optional initialization value. That option is somewhat buggy
> (when it is initialized) in preview 3, but should be fixed in Beta 1
> so that it is initialized when the agent is created.
> On Mar 11, 2007, at 6:09 PM, josh wrote:
> > Hi,
> > I hope these aren't faqs, but I sure couldn't find any answers:
> > could somebody please tell me what the heck a "patch variable" is?
> > (the
> > description in the docs makes it sound identical to an agent
> > variable.)
> > Also, the variable declarations themselves have an end slot to take an
> > argument. Can I use this to initialize the variable, or why can I plug
> > in a number to the end of the var. declaration block?
> > Thanks in advance for help!
> > -j
> > _______________________________________________
> > starlogo-users mailing list
> > starlogo-users at media.mit.edu
> > http://education.mit.edu/mailman/listinfo/starlogo-users
> starlogo-users mailing list
> starlogo-users at media.mit.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the starlogo-users