Predator Prey

A model of Rabbits eating Grass



Agents

Number of agents: 3

Behaviors


CounterCounter

Number of methods: 1


WHILE-RUNNING ()

Put text here to explain what this method does!

Number of rules: 1 

If
SEE ((0 0) , counter)
Then
SET (@Rabbit , to , 0), and
BROADCAST (Rabbit , rollcall)



GrassGrass

Number of methods: 3


WHILE-RUNNING ()

Grass goes down when a rabbit is on top
Grass goes down if a bunny is on top
Grass changes color to show grassyness

Number of rules: 3 

If
SEE ((0 0) , grass), and
STACKED (immediately below , rabbit)
Then
SET (grassness , to , Min(0,grassness-30)), and
MAKE ((0 0) , Pickcolor)

If
SEE ((0 0) , grass), and
STACKED (immediately below , bunny)
Then
SET (grassness , to , Min(0,grassness-10)), and
MAKE ((0 0) , Pickcolor)

If
SEE ((0 0) , grass)
Then
SET (grassness , to , Min(100,grassness + .5)), and
MAKE ((0 0) , Pickcolor)

ON (Pickcolor)

It is the color for the grass to visually display what value it is

Number of rules: 1 

If
SEE ((0 0) , grass)
Then
MAP (grassness , to Color , between , 15263976 , for , 0 , and , 16384 , for , 100)

WHEN-CREATING-NEW-AGENT ()

Sets a random amount of Grass to start off with

Number of rules: 1 

If
SEE ((0 0) , grass)
Then
SET (grassness , to , random(100))



RabbitRabbit

Number of methods: 2


WHILE-RUNNING ()

Put text here to explain what this method does!

Number of rules: 8 

If
SEE ((0 0) , rabbit), and
IS (age , > , 500), and
%-CHANCE (50)
Then
ERASE ((0 0))

If
SEE ((0 0) , rabbit), and
SEE ((1 0) , grass), and
%-CHANCE (1)
Then
NEW ((1 0) , bunny)

If
SEE ((0 0) , rabbit), and
SEE ((0 1) , grass), and
%-CHANCE (1)
Then
NEW ((0 1) , bunny)

If
SEE ((0 0) , rabbit), and
SEE ((-1 0) , grass), and
%-CHANCE (1)
Then
NEW ((-1 0) , bunny)

If
SEE ((0 0) , rabbit), and
SEE ((0 -1) , grass), and
%-CHANCE (1)
Then
NEW ((0 -1) , bunny)

If
SEE ((0 0) , bunny), and
IS (age , > , 365)
Then
CHANGE ((0 0) , rabbit)

If
SEE ((0 0) , rabbit)
Then
MOVE-RANDOM-ON (grass), and
SET (age , to , age+1)

If
SEE ((0 0) , bunny)
Then
MOVE-RANDOM-ON (grass), and
SET (age , to , age+1)

WHEN-CREATING-NEW-AGENT ()

Put text here to explain what this method does!

Number of rules: 2 

If
SEE ((0 0) , rabbit)
Then
SET (age , to , random(500))

If
SEE ((0 0) , bunny)
Then
SET (age , to , 1)


This report was generated using AgentSheets Version 3.0.0