logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Programming AssignmentCourse #: PROG 2100 C++Assignment #4 (Zombies!) • Implement this simulation using simple ASCII characters for the grid and beings • Use the ASCII characters of ‘H’ for a human and ‘Z’ for a zombie. • Colors must be used help differentiate humans from zombies

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Programming Assignment Course #: PROG 2100 C++ Assignment #4 (Zombies!) v2 The goal for this project is to create a simple modified 2D predator-prey simulation (aka a zombie apocalypse). In this simulation the prey are humans and the predators are zombies. These beings live in a 20 x 20 grid of cells (a city).

Only one being may occupy a cell at a time. The grid is enclosed, so a being is not allowed to move off the edges of the city or appear on the other side.

Time is simulated in steps. Each being performs some action every time step. Humans behave according to the following rules (in order): • MOVE. For every time step, the humans randomly try to move (aka run screaming) up, down, left, or right. If the neighboring cell in the selected direction is occupied or would move the human out of the city (i.e. off the grid), then the human stays in the current cell.

• RECRUIT. If a human survives for three time-steps, at the end of the time step the human will recruit a new human into an adjacent empty space. This is simulated by creating a new human in an adjacent (up, down, left, or right – i.e. diagonal not allowed) cell that is empty. If there is no empty cell available, no recruiting occurs. Once a recruit is produced, a human cannot recruit again until it has survived three more steps.

If humans are still alive and are unable to recruit (i.e. are surrounded by zombies and or edges) their recruit counter should be reset to zero. Zombies behave according to the following rules (in order): • MOVE/EAT. For every time step, the zombie will move to an adjacent cell (diagonal allowed) containing a human and eat the human. If there are no humans in adjoining cells, the zombie moves according to the same rules as the human (diagonal not allowed). Note that a zombie will not eat another zombie (because they taste bad).

• CONVERT. If a zombie survives for eight time-steps, and after it has moved/eaten, it will convert a randomly selected adjacent (including diagonal) human into a zombie (i.e. replace the human with a new zombie). If a zombie is still alive and are unable to convert, their convert counter should retain a state so that they will convert a human provided the very next opportunity (post move/eat).

• STARVE. If the zombie has not eaten any humans within three time-steps, at the end of the third time step the virus will lose its hold and the zombie will convert to a human (i.e. replace the zombie with a new human). Requirements:

• This should be implemented as a polymorphic process that does not require down-casting. • Each ‘turn’ (time-step) will be represented by a single pass through the array based on a timer event.

• Implement this simulation using simple ASCII characters for the grid and beings • Use the ASCII characters of ‘H’ for a human and ‘Z’ for a zombie. • Colors must be used help differentiate humans from zombies

• Create a class named Organism that encapsulates basic data common to all humans and zombies. This class should have a virtual function named ‘move’ that is defined in the sub classes Human and Zombie. • Set a flag to ensure that each creature can only move / eat / recruit once per turn because in their turn they may move lower in the array on get an (illegal) chance to move again.

• The city class can only hold up-cast humans and zombies, not lines representing the grid itself.

• All move, eat, and recruit / convert routines must identify valid targets and randomly select amongst them in order to establish a nominal balance.

Notes / Tips:

• You will be provided with some header files to help you get started.

• Make the city dimensions, # of humans, and # of zombies, etc. into constants all in one place (e.g. a header) to make debugging and tuning easier. • At run-time, you should see a cyclical pattern between the population of predators and prey. If extinction events happen too often, some ‘tuning’ may be required. e.g. guiding the initial placement of zombies so that they are not bunched up. Based on: ‘Doodlebugs’, Savitch, Absolute C++, 3rd edition

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

948 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

772 Answers

Hire Me
expert
Husnain SaeedComputer science

751 Answers

Hire Me
expert
Atharva PatilComputer science

743 Answers

Hire Me

Get Free Quote!

316 Experts Online