Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

Re: to create newEntity by an Agent

New Message Reply Date view Thread view Subject view Author view

Subject: Re: to create newEntity by an Agent
From: Pierre Bommel (bommel@cirad.fr)
Date: Wed Mar 29 2006 - 19:15:31 CEST

Salut Romain,

The best solution to create a new entity XXX and collect it at the
level of your model (theXXXs), is to use "newEntity:".
ex: newInstance := self newEntity: Egg.

Here is an example of ECEC model :

reproduce
| newForager freePlace |
        self energy > self class fertilityThreshold
                ifTrue:
                        [freePlace := self nearestEmptyLocation.
                        freePlace ifNil:[^nil].
                        newForager := self newEntity: self class.
                        self energy: self energy - newForager energy.
                        newForager moveTo: freePlace]
Até mais,

        Pierre

Le 24 mars 06, à 12:52, Romain Lorrilliere a écrit :

> Hello,
>
> I want to model the laying proccess.
> I would like that each instance of one agent could order the creation
> of new instances of another agent.
> I have an instance "female-x" of the agent "Female" and I want
> female-x to create many different instance of agent "Egg" in her
> patch.
> How can I do that ?
> Thanks
>
> Bye
>
> --
>
> Lorrillière Romain
>
>
> UMR 8079 Laboratoire Ecologie, Systématique et Evolution
>
> Bât. 362
>
> Université Paris-Sud
>
> 91405 Orsay cedex
>
> France
>
>
> tel : 01 69 15 56 85
>
> fax : 01 69 15 56 96
>
> mobile : 06 81 70 90 70
>
>
> email : romain.lorrilliere@ese.u-psud.fr
>
>
>
>
        Pierre Bommel - CIRAD - UR Green
        Universidade de Brasilia - CDS
        SHIS QI 26, Conjunto 15, Casa 18
        71670-150
        Brasilia DF
        tel: (00 55 61) 3367 3405
        http://www.cirad.fr/ur/green

New Message Reply Date view Thread view Subject view Author view
 

Back to home