Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

"step" conflict between agents?

New Message Reply Date view Thread view Subject view Author view

Subject: "step" conflict between agents?
From: Pierre-Marcel GORAL (corran_pmg@hotmail.com)
Date: Mon Mar 15 2004 - 11:03:07 CET

                              Hello everybody!
                 First of all thanks to those who answer my last question!
            Proceeding with the secund tutorial of the CIRAD site, I've tried to ameliorate the model Forager-Plant by introducing Predators. I'm a very beginner in Cormas, so excuse me if the answer to my problem is trivial  ;-) . I tried to use functions of the example "Pursuit", but it's a lot different of my own code, so I don't understand everything...
           The first problem is bigger now: the predator moves, but I am a bit disappointed: the Foragers don't do any! thing anymore!!! And I didn't change their implementation, nor the lines in the main function step of the model in which they are concerned. I tried to change the "step" function of Predators, and all their attributes and procedures, in order to sperate them clarly of the procedures and attributes of Forager, because I expected a conflit with same name functions, but that's not the case...

Here is the implementation of the main "step" function.

"Evolution des ressources"
 super stepEntities: self thePlants.
"Evolution des Agents"
 self theForagers do: [:a | a step].
 self thePredators do: [:b | b stepPredator].

 "self updateAgents."
"Evolution des Herbivores
 super stepDynPop: self theForagers.
Evolution des Predateurs
 super stepDynPop: self thePredators."

 Oh, yeah, and there is another one: the foragers eaten by Predators don't die, surely because I don't use the proper function... Here is the function "eat" of the Predator:

eatPredator
 "Le prédateur dévore l'herbivore qui est sur la même case que lui, et avale l'énergie de sa proie."
 (self patch theOccupants at: #Forager) isEmpty
  ifFalse: [(self patch theOccupants at: #Forager)
   do: [:p | p dead: true.
    self energyPredator: self energyPredator + p energy.] ].
  " [self patch theOccupants at: #Forager] dead: true."

It'll be nice of you if you pay attention to these problems. Thank you by advance!

Cordialement,

Pierre-Marcel GORAL



Trouvez l'âme soeur sur MSN Rencontres

New Message Reply Date view Thread view Subject view Author view
 

Back to home