[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Swarm-Support] Re: Walk to a spot on a 2d grid? 'Sense' the presence of
From: |
Jurgen van der Pol |
Subject: |
[Swarm-Support] Re: Walk to a spot on a 2d grid? 'Sense' the presence of another agent in the vicinity? |
Date: |
Sun, 18 Apr 2004 23:31:47 +0200 |
Hail, oh SwarmWizards,
Ok, I'm going to ask a lot of dumb questions now and then for a while,
probably asking for beaten tracks, sorry.
Been browsing ftp.swarm.org in the mean time, and came up with lotsa
magical stuff, like in
Armyant
Clupeoids
Multi2d
NewBoids
SvenSpaces
sigh. so much to learn & understand... Ok, an aggregated reply:
- tell an agent to 'walk' to a certain spot on a 2d grid? Is there a
I had already figured this is about basic 2d vector math, so was happy
to find "vector.h" in the above (in a.o. NewBoids). Still not exactly
what I need, but helps.
I have placed an example of a simulation where agents do something
similar. It's placed at http://geohive.nr.usu.edu/~sanduku/swarm/
(get the example with shrimps). The things you ask about are
Wow. Ok, I think I get the idea. This is however opposite of what I
need: I need multiple occupancy per cell, and this enforces just the
opposite? Still the basic list-idea seems the way to go. I'll delve
deeper into it later this week.
My compiled ./biox breaks on a bus error, so couldn't 'see' it (OS X).
This is easy if you have a pre-determined "path" (ordered collection
True, but I want them to just 'go' there on a 2d cartesian grid via the
fastest route (straight-ish line).
this minute. I'm not completely happy with any of the solutions I've
come up with yet.
What I've spent today figuring out runs close to vector.h. The step
loop would be something like
while ( my(x,y) <> destination(x,y) )
{
get heading to destination //an angle, really, degrees (or
radians) versus a 0-baseline
find best fitting cell around me //angle versus the angles to the 8
surrounding cells (North=0, NE=45, E=90 etc)
move to best fitting cell //one of those 8
}
(Surely I can't be the first to be wanting something like this???)
if ( [[myCell getCellAtNorth] getAgent] != nil)
or
if ([[[myCell getCellInRadius: radius] getAgent] getOdor] == SMELLY)
Yes, I see what you're getting at. Not ready for that yet, though :-{.
But will have to crack that nut in the near future.
What are the equivalent Starlogo methods?
I've used things like
count-turtles-at
count-turtles-towards
distance
forward
heading
heading-at
heading-towards
list-of-turtles-towards
setheading
seth-at
seth-towards
step
see http://education.mit.edu/starlogo/commands.html
Why be afraid??
:-) just daunted (and bleeding at that proverbial edge)...
Sven T wrote a class for multi agents and I've worked on extensions
over
the years. His file is in the Swarm ftp called, I think, SvenSpaces,
or
Yes, found those already and they help a lot, at least in thinking
-how- to do it (coding is another chapter :-/).
measurements. If you look in my Swarm page (address below), look in
the
MySwarmCode directory for the Opinion project. Look for version 2.0.
That shows the MultiGrid2d class in action. MultiGrid2d is a Swarm grid
Wow. Impressive. Much to study here... If I can 'get' what you do here
and adapt it (if needed), it would make my life a lot easier... 3
years, you said?
So, basically the consensus is that you put an object with a list in it
on each grid cell, then pass stuff around by pushing/popping them
to/fro those lists. I can see it work, it just seems a bit ...
cumbersome (?) to me (c.f. starlogo). But whom am I to judge, Ive just
passed userbook chapter 6's into ("Do Your Homework!")...
Thou art wizzards truly.
Thanks a bundle, all!
Jurgen.
- [Swarm-Support] Re: Walk to a spot on a 2d grid? 'Sense' the presence of another agent in the vicinity?,
Jurgen van der Pol <=