82
X-Machines for Agent-Based Modeling: FLAME Perspectives
#define fox_eat_length 1.0
/** \def Distance foxes can run */
#define fox_run_length 1.5
/** \def Distance rabbits can run */
#define rabbit_run_length 1.0
/** \def Distance rabbits can see foxes */
#define rabbit_view_length 10.0
/**Example Library functions file**/
/** \fn Handle agent positions with respect to the boundary
* \param position The current position in one axis
* \return The new position mirrored along the boundary
*/
double handle_boundaryX(double position)
{
double newPosition = position;
if(position < 0.0) {
newPosition = (-1) * position;
position = newPosition;
}
if (position < 20.0) {
newPosition = position + 20;
position = newPosition;
}
if(position > 950.0) {
newPosition = position - (position - 950) + 20;
}
return newPosition;
}
double handle_boundaryY(double position)
{
double newPosition = position;
if(position < 0.0) {
newPosition = (-1) * position;
position = newPosition;
}
if (position < 20.0) {
newPosition = position + 20;
position = newPosition;
}
X-Machines for Agent-Based Modeling: FLAME Perspectives
#define fox_eat_length 1.0
/** \def Distance foxes can run */
#define fox_run_length 1.5
/** \def Distance rabbits can run */
#define rabbit_run_length 1.0
/** \def Distance rabbits can see foxes */
#define rabbit_view_length 10.0
/**Example Library functions file**/
/** \fn Handle agent positions with respect to the boundary
* \param position The current position in one axis
* \return The new position mirrored along the boundary
*/
double handle_boundaryX(double position)
{
double newPosition = position;
if(position < 0.0) {
newPosition = (-1) * position;
position = newPosition;
}
if (position < 20.0) {
newPosition = position + 20;
position = newPosition;
}
if(position > 950.0) {
newPosition = position - (position - 950) + 20;
}
return newPosition;
}
double handle_boundaryY(double position)
{
double newPosition = position;
if(position < 0.0) {
newPosition = (-1) * position;
position = newPosition;
}
if (position < 20.0) {
newPosition = position + 20;
position = newPosition;
}
