Trophic+Levels+ODD

=Overview=

Purpose
The purpose of this model is the represent the dynamics of different trophic levels interacting.

Mouse

 * Position
 * Energy
 * Behavior State
 * Forage
 * Flee
 * Reproduce

Cat

 * Position
 * Energy
 * Behavior state
 * Chase
 * Reproduce
 * Litter Size

Land

 * State (Grass/Dirt/Hole)
 * Position
 * Sun Level
 * Countdown to growth

Land

 * If a dirt patch's energy level is above a minimum threshold, it becomes a grass patch.
 * If a grass patch is eaten by a mouse, become a dirt patch.

Mice

 * If any cats are within the mouse's safe-radius, face the nearest hole and move toward it
 * If a mouse fleeing from a cat reaches a mouse hole, it randomly moves to a new mouse hole
 * If there are not cats within the mouse's safe radius and the mouse is on a grass patch, the mouse eats the grass and gains a percentage of maximum energy
 * If there are no cats nearby and the mouse is not on a grass patch, turn randomly up to 50 degrees in either direction and take a step forward

Cats

 * Set the nearest mouse as the agent's target
 * If the agent is within the defined safe-radius of its target, move to the target's location and eat it, destroying the target and gaining energy equal to a percentage of the target's energy.

=Design Concepts=

Basic Principles

 * Grass is a producer.
 * Mice are primary consumers.
 * Also, they can hide/travel underground.
 * Cats are secondary consumers.

Adaptation

 * Mice adapt to discovering cats within their safe-radius by moving to the nearest hole, or, if they are already at a hole, traveling "underground" to a different hole.

Sensing

 * Mice can sense the presence of cats within their safe-radius.
 * Cats can sense the presence of any mouse on the grid.

Interaction

 * Mice interact with the land directly by eating grass, which gives them energy and turns green patches brown until they accumulate enough energy to regrow grass.
 * Cats interact with mice indirectly by eating them and obtaining a percentage of the mouse's energy.

Stochasticity

 * Stochasticity is used in initializing the model when it assigns each mouse and cat agent a random amount of energy as well as a random position on the grid.
 * If a mouse agent does not have a cat in its safe-radius to run from, it takes its next step in a random direction.

Observation
=Details=

Initialization

 * ===Land===
 * The amount of initial grass is determined by a slider, and they are distributed randomly on the grid. The rest of the patches remain brown.
 * The number of holes is also determined by a slider, and these are also distributed randomly on the grid.
 * ===Mice===
 * The initial amount of mice is determined by a slider and the energy for each mouse agent is initialized to a random amount within their maximum energy (also determined by a slider). Once created, they are immediately moved to the nearest hole.
 * ===Cats===
 * The initial amount of cats is determined by a slider and the energy for each cat agent is initialized to a random amount within their maximum energy. They are distributed randomly on the grid and immediately set their target to the nearest mouse.

Input data

 * none.

Submodels

 * ===Mice Move===
 * If there aren't any cats within the mouse's safe radius and it's on grass, it eats the grass and gains energy. Otherwise, it randomly moves one spot.
 * If there are cats nearby and the mouse is at a hole, it transports away from the cat to a different hole. If the mouse isn't at a hole, it moves a step toward the nearest hole.
 * If a mouse's energy has surpassed the maximum energy, it divides its energy in half and spawns one new mouse.
 * ===Cats Move===
 * If a cat has a target and the cat is within the mouse's safe radius, it pounces on the mouse and gains energy. If it is too far away, it faces its target and moves towards it one step.
 * If it doesn't have a target, it sets its target as the nearest mouse.
 * If its energy has surpassed the maximum energy, it divides its energy based on its litter size and spawns some new cats.