Agents in Biology
219
RADIUS = 8.0;
} else if (SIZE >= 30 && SIZE < 40) {
RADIUS = 9.0;
} else if (SIZE >= 40 && SIZE < 50) {
RADIUS = 10.0;
} else if (SIZE >= 50 && SIZE < 60) {
RADIUS = 11.0;
} else if (SIZE >= 60 && SIZE < 70) {
RADIUS = 12.0;
} else if (SIZE >= 70 && SIZE < 80) {
RADIUS = 13.0;
} else if (SIZE >= 80 && SIZE < 90) {
RADIUS = 14.0;
} else if (SIZE >= 90) {
RADIUS = 15.0;
}
add_foodInformation_message(FOODID, FOODX, FOODY, SIZE, RADIUS);
return 0;
}
//Nest agent
//add nestInfo
int nestInformation() {
add_nestInformation_message(NESTX, NESTY, NESTRADIUS);
return 0;
}
//Pheromone agent
//add pheromoneInfo
int pheromoneInformation() {
add_pheromoneInformation_message(PHEROMONEID, PHEROMONEX, PHEROMONEY, LIFE);
return 0;
}
int Ant_idle()
{
return 0;
}
//Ant agent
//deposit a pheromone at each step
//if a pheromone was previously deposited at a particular coordinate,
increase pheromone level
//if not create a new one
int reinforce()
{
double distance=0.0;
pheromoneInformation_message = get_first_pheromoneInformation_message();
while (pheromoneInformation_message)
{
if(PHEROFOUND == 0)
{
distance = getDistance(ANTX, ANTY, pheromoneInformation_message->
pheromoneX, pheromoneInformation_message->pheromoneY);
if (distance > 0.3 && distance <= minPheromoneDistance)
{
PHEROFOUND = 1;
Précédent

- 248/329

Suivant