Tuesday September 17, 2013
This problem concerns a model of a population of rabbits. The problem is an extension of Rabbit Reproduction, http://hpcuniversity.org/students/weeklyChallenge/58/. You may want to familiarize yourself with that problem first.
Your task is to create a model that tracks the movement, hunger, reproduction, and death of rabbits.
In this model, rabbits move around in a 2D environment that is 100 squares by 100 squares. Each square in the environment has a certain amount of grass on it. If a rabbit is hungry and on a square with grass, it eats the grass until it is full. If a rabbit is hungry for too many time steps, it dies of starvation.
If a rabbit is in a square with 0 grass, it moves randomly to an empty square to the north, east, south, or west (or stays put if all those squares are full). Each square can have a maximum of 1 rabbit on it at each time step.
Each rabbit starts with 10 points of hunger and cannot exceed 10 points at any given time. Each time step, each rabbit loses a point of hunger. If a rabbit is at or below 5 points of hunger, it is considered hungry, and it will eat grass if the grass is available on its square. If the rabbit drops to 0 points of hunger, it dies.
Each square starts with 10 points of grass and cannot exceed 10 points at any given time. Grass in an empty square regrows by 1 point every time step.
Rabbits that have at least 5 points of hunger can reproduce asexually with some percent chance. To reproduce, there must be at least 1 empty square to the north, east, south, or west of the rabbit. The new rabbit is placed randomly in one of those empty squares. When a rabbit reproduces, its hunger points are divided between itself and the new rabbit as evenly as possible, with the remainder discarded.
The model should start with a single, randomlyplaced rabbit.
The model should take a number of time steps as input, which specifies how long a particular simulation should run. As output, it should show the state of the grid at each time step  how many grass points each square has, and how many hunger points the rabbit on each square has.
In this model, rabbits move around in a 2D environment that is 100 squares by 100 squares. Each square in the environment has a certain amount of grass on it. If a rabbit is hungry and on a square with grass, it eats the grass until it is full. If a rabbit is hungry for too many time steps, it dies of starvation.
If a rabbit is in a square with 0 grass, it moves randomly to an empty square to the north, east, south, or west (or stays put if all those squares are full). Each square can have a maximum of 1 rabbit on it at each time step.
Each rabbit starts with 10 points of hunger and cannot exceed 10 points at any given time. Each time step, each rabbit loses a point of hunger. If a rabbit is at or below 5 points of hunger, it is considered hungry, and it will eat grass if the grass is available on its square. If the rabbit drops to 0 points of hunger, it dies.
Each square starts with 10 points of grass and cannot exceed 10 points at any given time. Grass in an empty square regrows by 1 point every time step.
Rabbits that have at least 5 points of hunger can reproduce asexually with some percent chance. To reproduce, there must be at least 1 empty square to the north, east, south, or west of the rabbit. The new rabbit is placed randomly in one of those empty squares. When a rabbit reproduces, its hunger points are divided between itself and the new rabbit as evenly as possible, with the remainder discarded.
The model should start with a single, randomlyplaced rabbit.
The model should take a number of time steps as input, which specifies how long a particular simulation should run. As output, it should show the state of the grid at each time step  how many grass points each square has, and how many hunger points the rabbit on each square has.
Show solution
Challenge Resources:
Rabbits 2 zip file
—
zip file containing the C code for a solution to the Rabbits 2 challenge problem.
©19942014

Shodor

Privacy Policy

NSDL

XSEDE

Blue Waters

ACM SIGHPC





Not Logged In. Login