[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Swarm-Modelling] Re: world getObjectAt and Others
From: |
Norberto Eiji Nawa |
Subject: |
[Swarm-Modelling] Re: world getObjectAt and Others |
Date: |
Mon, 16 Jun 2003 08:38:03 +0900 |
Georg,
G> but how can catch the event of the meeting of two ants so that I can
G> implement the exchange of the food and the change in the walking
G> direction?
couldn't you detect ant encounters in the if-check below? If the
position to where an ant tries to move to is already occupied by
someone, you could check the type of the element in that position, and
according to that, implement the suitable actions (exchange
food/walking direction).
Hope it helps (But I think I'm missing your point...)
Eiji
--
// ...[snip]
// Check that no other ant is at the new site.
if ([world getObjectAtX: newX Y: newY] == nil)
{
[world putObject: nil atX: xPos Y: yPos];
xPos = newX;
yPos = newY;
[world putObject: self atX: newX Y: newY];
}
// ...[snip]
--
- [Swarm-Modelling] Re: world getObjectAt and Others,
Norberto Eiji Nawa <=