Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You will be creating a simple two-dimensional predator-prey simulation. In this

ID: 3603363 • Letter: Y

Question

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

Explanation / Answer

#include "Bunny.h" void spawn_bunnies(list&b); //runs only once in the beginning to instantiate the first 5 bunny objects void end_turn(list&); // runs every ~2 seconds bool male_available(const list&); //checks if there is a "valid" male available to reproduce list females_available(const list&); //returns list of "valid" females to reproduce void create_babies(list&); //uses list of females_available to determine color of bunny babies, as well as the # of babies void transform_random_bunny(list&b); //transforms n random normal bunnies into mutant bunnies. n = num of current mutant bunnies void bunnies_die(list&); //kills half of the bunnies when their count is above 1000 list get_normal_bunnies(const list& b); //returns a list of normal bunnies
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote