c++ program

Cancelado Publicado Feb 2, 2016 Pagado a la entrega
Cancelado Pagado a la entrega

I need someone to writ the following program with a lot of comments to explain why thing are done the way they are

You will use cellular automata to create a simple 2D predator–prey simulation in your program.

The prey are ants and the predators are doodlebugs. These critters live in a 20 * 20 grid of cells.

Only one critter may occupy a cell at a time. The grid is enclosed, so no critter may move off the

grid. Time is simulated in steps. Each critter performs some action every time step.

The ants behave according to the following model:

■ Move- For every time step, the ants randomly try to move up, down, left, or right. 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, at the end of the time step (i.e., 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, no breeding occurs. Once an offspring is

produced, an ant cannot produce an offspring again until it has survived three more time steps.

The doodlebugs behave according to the following model:

■ Move- For every time step, the doodlebug will move to an adjacent cell containing an ant and eat the ant. If there are no ants in adjoining cells, the doodlebug moves according to the same rules as the ant. Note that a doodlebug cannot eat other doodlebugs.

■ Breed- If a doodlebug survives for eight time steps, at the end of the time step it will spawn off a new doodlebug in the same manner as the ant.

■ Starve- If a doodlebug has not eaten an ant within three time steps, at the end of the third time

step it will starve and die. The doodlebug should then be removed from the grid of cells.

You will prompt the user to enter the number of time steps to run. For each time step do the

following in your program. After all moves, breeding, eating, and starving is resolved display the

resulting grid. The doodlebugs will move before the ants in each time step. Draw the world using

ASCII characters of “O” for an ant and “X” for a doodlebug. When you reach the time step

entered by the user ask them to enter another number or to exit the program.

Create a class named Critter that contains data and functions common to ants and doodlebugs. This class should have a virtual function named move that is defined in the derived classes of Ant and Doodlebug. You must maintain the state of the current grid while creating the next display. You will use a dynamic array to represent the grid. Each array element will be a pointer to Critter. Initialize the world with 5 doodlebugs and 100 ants. You will randomly place them. You should see a cyclical pattern between the population of predators and prey, although random perturbations may lead to the elimination of one or both species. Get your program running and tested.

Programación en C++

Nº del proyecto: #9539245

Sobre el proyecto

11 propuestas Proyecto remoto Activo Feb 2, 2016

11 freelancers están ofertando un promedio de $26 por este trabajo

xzan88

Hi, I am an experienced C++ programmer. I can write this in a short amount of time with comments in proper english. Please contact me via private message,

$25 USD en 1 día
(103 comentarios)
6.2
Weebside

Hello, Sir Weebside Inc. is a professional freelancer service provided to worthy clients like you. We can provide our best developers to provide you High-Quality Development with 100% Delivery Rate, 100% Satisfaction. Más

$25 USD en 1 día
(113 comentarios)
5.9
Anurag7

Hi I have 11 years of experience and have good understanding of your problem. I like to work on your project.

$35 USD en 1 día
(14 comentarios)
4.4
kteja85

A proposal has not yet been provided

$30 USD en 1 día
(9 comentarios)
4.0
zmi

Hello, can you tell me more about your project? So we can discuss about details. Best regards, Zmi

$25 USD en 1 día
(3 comentarios)
2.9
TechnoVilla

Dear Sir/Madam, I have over 8 years of work experience in C, C++, C# and so on... I only bid on projects that I know I can complete successfully. Please visit the links below to see some of my skills and to Más

$25 USD en 1 día
(3 comentarios)
2.5
igotmail9

Dear Sponsor, I am a hard core developer with 14 years of experience in software development with Java (3Y), C++ (10Y), C#(3Y), Visual Basic, Excel, VBA programming, Web programming, HTML5, PHP, MySQL, Linux and Win Más

$34 USD en 3 días
(3 comentarios)
1.8