file habitat <- file("XXXX.shp");
file world_enveloppe <- file("XXXX.shp");
image_file my_icon <- file("XXXX.png");
init
{
step <- 1 #day;
create world_boundaries from: world_enveloppe
{}
world_boundaries_shape <- first(world_boundaries).shape;
create habitats from:habitat with:[DN::int(read("Validmean"))]
{}
create prey number: preyinit
{
location <- any_location_in(world_boundaries_shape ); // location anywhere within the group perimeter
}
}
}
species world_boundaries
{}
species habitats
{
int DN;
aspect default{
switch (DN)
{
match 12 {draw shape color:rgb([0, 128, 0]); } // pasture
match 13 {draw shape color:rgb([0, 255,0]); } // crops
match 14 {draw shape color:rgb([128, 128, 0]);} // vineyard
match 15 {draw shape color:rgb([255, 128, 0]); } // cities
}
}
reflex rodent_in_habitas
{
list<prey> rod_in_habitats <- agents_overlapping (self);
rod_sum <- sum (sample(rod_in_habitats));
}
}
species rodent skills: [moving]
{
float speed <- 1#m/#hour; // test value
reflex move
{
do wander speed:speed amplitude:60.0 bounds: geometry(world_boundaries_shape);
}
}
reflex update_time_in_habitat {
if location overlaps habitats[1].shape {
time_in_hab <- time_in_hab +1;
write time_in_hab;