swarm-support
[Top][All Lists]
Advanced

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

[no subject]


From: Kevin Allen
Date: Mon, 21 Apr 1997 15:17:43 +0000

Hi Guys

I am trying to produce a simulation and I feel that I have missed something 
important.

I have created a class Agent

@interface Agent: SwarmObject{
int xPos,yPos;
Grid2D * world;
id environmentSpace;
}


I have created another class Interactor

@interface Interactor: Agent{
}


I then do the following:

I create a single agent and a list of interactors.

In buildActions of my model:

[Actions createActionTo: agent message: M(step)];
[Actions createActionForEach: interactorList message M(sense)];

in Agent.m

-step{
...
stepX = xPos;
stepY = yPos;
...
}

in Interactor.m

-sense{
...
hereX = xPos;
hereY = yPos
...
}

Now I was under the impression that an instance of Interactor would take the 
properties of Agent. I
would then be able to use xPos and yPos from within an action called by 
Interactor.
in stepI get the expected result but in sense I get 0 (zero).




I also tried to achive the same result by defing an action getX:Y:

-getX: (int *) x Y: (int *) y;

I do the following:

I create a single agent and a list of interactors.

In buildActions of my model:

[Actions createActionTo: agent message: M(step)];
[Actions createActionForEach: interactorList message M(sense)];

in Agent.m

-step{
...
[agent getX: &stepX Y: &stepY];
...
}

in Interactor.m

-sense{
...
[agent getX: &hereX Y: &hereY];
...
}


I had expected that [agent getX:Y:] would work in both places. In step I get 
incorrect values and in
sense I get a sementation fault.

Is this enough information and can anyone help?


Kevin Allen
Intelligent Autonomous Systems Engineering Lab, UWE.


                  ==================================
   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.
                  ==================================


reply via email to

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