Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

Re: newborn genetic deficiences (no IA, ;-) ) (more info)

New Message Reply Date view Thread view Subject view Author view

Subject: Re: newborn genetic deficiences (no IA, ;-) ) (more info)
From: Pierre Bommel (bommel@cirad.fr)
Date: Fri Mar 19 2004 - 16:51:44 CET

Bonjour Pierre-Marcel,

If I have well understood, you should have in your main "step:" method
(as Christophe said) :
step: t
"Evolution des Ressources"
 super stepEntities: self thePlants.
"Evolution des Herbivores"
 super stepDynPop: self theForagers.
"Evolution des Predateurs"
 super stepDynPop: self thePredators

The stepDynPop method is as following :
 The stepDynPop: aCollec
| newBorns repro |
 newBorns := OrderedCollection new.
 (Cormas mixt: aCollec)
  do: [:anAgent |
   repro := anAgent step.
   repro notNil ifTrue: [newBorns add: repro]].
 self update: aCollec with: newBorns

It means that you should keep the same name "step" as the general method

for Predator and Prey (as Christophe said again ! :o) ). Normally, this
should work, but do not forget to return the new born at the end of your
step method (.... ^newBorn)

Another way could be :
step: t
| newForagers newPredators |
            "Evolution des Ressources"
    self thePlants do: [:cell| cell step].
            "Evolution des Herbivores"
    newForagers := OrderedCollection new.
    self theForagers do: [:f | newForagers add: f step].
            "Evolution des Predateurs"
    newPredators := OrderedCollection new.
    self thePredators do: [:p | newPredators add: p step].
            "removing the dead agents and adding the new borns to the
collections theForagers and thePredators"
     self update: self theForagers with: newForagers.
     self update: self thePredators with: newPredators.

In the next version, Cormas should propose an Entity-Collector that will
automatically update the collection of agents and others entities. This
version should be released in April...
Best regards,

    Pierre

Pierre-Marcel GORAL a écrit :

> Last news: I manage to obtain new Foragers, cheating on the energy
> needed to reproduce, but they are as dumb as new Predators. I think
> it's due to the function "updateAgents", because when I see the
> implementation oh this, I only see lines about dead agents, and not
> about new ones! Maybe ther's another function for new lives!
> If you know how to do, please answer me!
> Thank you by advance!
>
> Cordialement,
>
> Pierre-Marcel GORAL
>
>
> -----------------------------------------------------------------------
> MSN Search, le moteur de recherche qui pense comme vous ! Cliquez ici
> !

--
***********************************
  Pierre Bommel
  CIRAD TA 60/15
  73, rue Jean-François Breton
  34398 Montpellier cedex 5 France
  Phone: +33 (0)4 67 59 38 53
  Fax: +33 (0)4 67 59 38 27
  http://cormas.cirad.fr
***********************************

New Message Reply Date view Thread view Subject view Author view
 

Back to home