Question: Ant VS Doodlebug Simulation C++ Predator - Prey simulation Assigned: October 25, 201'7 Due: November 15 by 11:59:59 pm You wil be creating a predator-prey
Ant VS Doodlebug Simulation C++ Predator - Prey simulation



Assigned: October 25, 201'7 Due: November 15 by 11:59:59 pm You wil be creating a predator-prey simulator, with ants and doodlebugs Class Requirements: Simulation Requirements The critters live in a 20 x 20 grid of cells *Only one critter may occupy a cell at a time *The grid is enclosed; a critter may not move beyond the edges - Time is simulated in steps Each critter performs some action every time step - Behavior of ants *Move: For every time step, the ants randomly try to move up, down, left, or right. If that cell is occupied or would result move the ant off the grid, then the ant stays in the current ce *Breed: If an ant survives for three (3) 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 and adjacent cell (no diagonals) 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 u it has survived three more time steps Behavior of doodlebugs *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 adjacen cells (remember, no diagonals), the doodlebug moves according to the same rules as the ant NOTE: A doodlebug cannot eat another doodlebug *Breed: If a doodlebug survives for eight (8) 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 t wll starve and die. The doodlebug should then be removed from the grid of cells During one turn, ALL DOODLEBUGS should move before the ants - Represent ants with "O" and doodlebugs with "X" - Initialize the world with 5 doodlebugs and 100 ants After a time step, the user will be prompted to press Enter to proceed to the next time step . Assignment Requirements - Create a base class and call it Critter - It should not be possible to declare a an object of type Critter outside of any derived classes Assigned: October 25, 201'7 Due: November 15 by 11:59:59 pm You wil be creating a predator-prey simulator, with ants and doodlebugs Class Requirements: Simulation Requirements The critters live in a 20 x 20 grid of cells *Only one critter may occupy a cell at a time *The grid is enclosed; a critter may not move beyond the edges - Time is simulated in steps Each critter performs some action every time step - Behavior of ants *Move: For every time step, the ants randomly try to move up, down, left, or right. If that cell is occupied or would result move the ant off the grid, then the ant stays in the current ce *Breed: If an ant survives for three (3) 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 and adjacent cell (no diagonals) 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 u it has survived three more time steps Behavior of doodlebugs *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 adjacen cells (remember, no diagonals), the doodlebug moves according to the same rules as the ant NOTE: A doodlebug cannot eat another doodlebug *Breed: If a doodlebug survives for eight (8) 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 t wll starve and die. The doodlebug should then be removed from the grid of cells During one turn, ALL DOODLEBUGS should move before the ants - Represent ants with "O" and doodlebugs with "X" - Initialize the world with 5 doodlebugs and 100 ants After a time step, the user will be prompted to press Enter to proceed to the next time step . Assignment Requirements - Create a base class and call it Critter - It should not be possible to declare a an object of type Critter outside of any derived classes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
