Print

Print


I like the deathQue since I will eventually have a large number of agents.
Do you have an example off the top of your head that shows how to stop.

I assume I would make a call in here but I am not sure what to get a handle
to get them to stop
https://github.com/thesteve0/startmason/blob/master/src/org/thesteve0/steptwo/Runner.java#L57

Thanks
Steve

On Fri, Sep 16, 2016 at 11:36 AM, John Filleau <[log in to unmask]> wrote:

> Depending on the number of agents, it may be faster to have each agent
> assign itself to a global death-queue. Then, the simulation only needs to
> iterate over this smaller queue, instead of the entire list of agents.
>
>
>
> If you have a small number of agents, though, just do the flag-and-iterate
> method.
>
>
>
> -John
>
>
>
> *From:* MASON Multiagent Simulation Toolkit [mailto:MASON-INTEREST-L@
> LISTSERV.GMU.EDU] *On Behalf Of *Steven Pousty
> *Sent:* Friday, September 16, 2016 2:31 PM
> *To:* [log in to unmask]
> *Subject:* Getting an agent to kill itself
>
>
>
> Greetings all:
>
> I am trying to get an agent to "kill" itself based on some feature of the
> agent.
>
>
>
> In my example it is when the agent walks "too far" over the edge of the
> world.
>
> https://github.com/thesteve0/startmason/blob/master/src/
> org/thesteve0/steptwo/Animal.java#L135
>
>
>
> But this doesn't work. I suspect because the Agent still lives on and all
> I am doing is removing it from being displayed on the grid.
>
>
>
> I have read the docs and looked at the asteroid example. It seems like I
> need to action kill the agent from the SimState. If this is true then it
> seems like I should set a flag on the agent like "dead=true" and then at
> the start of each step iterate through all the agents and Stop() all that
> are dead.
>
>
>
> Is this correct or is there a way to "kill" an agent from within an agent?
> I will need to do this in the future if the animal does not eat enough or
> walks through too much bad habitat.
>
>
>
> Thanks again for all the help!
>
> Steve
>