Question: Programming in C or C++ language. I really help with this project, as it's constantly getting back on me, and I still don't get the

Programming in C or C++ language. I really help with this project, as it's constantly getting back on me, and I still don't get the point. So with many thanks to the person that would help me solve this.

Your program will create a 2D array of 10x10.

Each location can host a predator, a prey, or nothing.

Pick 10 random locations for prey and one for a predator...make sure that they do not overlap!

Print to the screen the 2D matrix as a matrix.

Wait for the user to press enter before continuing.Programming in C or C++ language. I really help with this project,as it's constantly getting back on me, and I still don't getthe point. So with many thanks to the person that would help

Keeping track of critters

Each creature, predator or prey, has a non-overlapping position.

Prey also keep track of how much they have eaten.

How many possible prey can you have?

10x10 = 100 (-1 for the predator)

If you have many prey, what data structure would be best to contain them?

Predator/Prey requirements

Each round, predator and prey can take an action.

A predator will choose, in order of preference to:

Move into the square of a neighboring prey. If it does, it eats the prey, which now disappears.

Move into a random neighboring square.

Then the prey act.

Eat (increment a counter) and move into a random neighboring square that is empty.

If there are no neighboring squares open, stay put

Think about how to store the total number of eats each prey has...

After each round, print the matrix.

Each round the model will act for each predator.

Eaten prey disappear from the original matrix and array.

The model will then act for all remaining prey.

Print the matrix.

Wait for user to press Enter

Repeat until there are no prey or no predators.

Modify the code to allow prey to reproduce after eating five times.

Modify the code to allow predators to reproduce after eating five times, but to lose one eating for every round without eating. Predators start with 4 eats and die if their eat count goes to 0. What happens to the model?

After implementing bonus A and B, run the simulation 20 times to completion. Record how often the simulation goes to all predators, how many times to all prey, and how many times unresolved.

Round 1 Pre Round 1 Round 1 00F 000000 0 0 0 0 0 0 0 0 0000000 0 0 0 0 0 00 OOO Round 1 Pre Round 1 Round 1 00F 000000 0 0 0 0 0 0 0 0 0000000 0 0 0 0 0 00 OOO

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!