Question: c++ coding You will be creating a simple two-dimensional predator-prey simulation. In this simulation the prey are ants and the predators are doodlebugs. These critters

c++ coding  c++ coding You will be creating a simple two-dimensional predator-prey simulation.
In this simulation the prey are ants and the predators are doodlebugs.

You will be creating a simple two-dimensional predator-prey simulation. In this simulation the prey are ants and the predators are doodlebugs. These critters live in a world composed of a 20 x20 grid of cells. Only one critter may occupy a cell at a time. The grid is enclosed, so a critter is not allowed to move off the edges of the world. Time is simulated in time steps. Each critter performs some action every time step. Doodlebugs eat Ants. 2 The ants behave according to the following model Move. Every time step, randomly try to move up, down, left, or right. (hints: you can use a random number generator to generate integer from 1 to 4, 1-right, 2-down, 3 = left, and 4 -up). If the neighboring cell in the selected direction is occupied or would move the ant off the grid, then the ant stays in the current cell Breed. If an ant survives for three time steps, then at the end of the time step (that is after moving) the ant will breed. This is simulated by creating a new ant in an adjacent (up, down, left, or right) cell that is empty. If there is no empty cell available, then no breeding occurs. Once an offspring is produced, an ant cannot produce an offspring until three more time steps have elapsed The doodlebugs behave according to the following model

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!