Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ 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

c++ image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

=+52-1 Describe the social tasks and challenges of adolescence.

Answered: 1 week ago

Question

Recognize the four core purposes service environments fulfill.

Answered: 1 week ago