C++ Game of Life Project

In Bearbeitung Veröffentlicht Feb 25, 2014 Bezahlt bei Lieferung
In Bearbeitung Bezahlt bei Lieferung

A variation on the Conway's Game of Life

In this assignment you will implement a variation of Conway's Game of Life, let's call it the CIS330 Game of Livestock. You do not have to reuse any of the farming-related code from lectures, a much simpler representation would suffice.

Here is a description of the rules:

The universe of the Game of Livestock is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of four possible states.

A cell can be empty or dead

A cell can have a sheep in it

A cell can have a wolf in it

A cell can have a farmer in it

Every cell interacts with its eight neighbors, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

If a cell contains a sheep and is surrounded by more than three sheep neighbors, the cell dies (becomes empty) by overpopulation.

If a cell contains a sheep and has at least one wolf as neighbor, the cell dies (becomes empty) by predation.

If a cell is empty and surrounded by exactly two neighbors of the same species, it is modified to contain a new instance of that species (reproduction). If a cell has two neighbors of more than one species, then the order in which they should be considered is sheep, wolf, and finally farmer.

If a cell contains a wolf and has at least one neighbor who is a farmer, the cell dies (becomes empty).

If a cell contains a farmer and has at least one empty neighbor cell, it moves to a randomly selected empty neighbor cell. If there is no empty neighbor cell, the farmer cell remains the same.

Problem 1

Implement the Game of Livestock by defining a Game class in files [login to view URL] and game.cpp. Your class should include methods for

Create an initial set of randomly selected cell values in the 2-D rectangular grid: empty, sheep, wolf, farmer.

Perform a transition according to the rules above for each time step.

Run the game by performing a certain number of steps, which are specified as a parameter.

You can add any other methods or additional classes that you may need.

Use STL containers to represent the grid, for example a vector of vectors of char, where 'S' designates a sheep, 'W' designates a wolf, and 'F' designates a farmer (and '.' designates an empty cell).

Create a Makefile to compile your source files into .o files.

Required files: Makefile, [login to view URL], [login to view URL]

Problem 2

Implement a test program in a file called [login to view URL] and update the Makefile to build a test-game executable. The program should prompt for user input as follows:

./test-game

Please enter the size of the grid (int int): 20 20

Please enter the number of steps (int): 10

then instantiate and initialize a Game object with the user-provided parameters and run the game for the number of steps given, printing the grid at each step.

Required files: [login to view URL], Makefile

C++ Programmierung

Projekt-ID: #5487134

Über das Projekt

5 Vorschläge Remote Projekt Aktiv Feb 25, 2014

5 Freelancer bieten im Durchschnitt $110 für diesen Job

it2051229

Hi, I am placing my bid on your project because I have read the requirements and I am confident enough with my C++ and algorithm skills. I am focused mostly on doing computer science homework here in freelancer.com and Mehr

$50 USD in 0 Tagen
(588 Bewertungen)
7.1
urmate

HI Contact me for an efficient, well documented and perfect solution and development of your project. I ensure quality work with always on time delivery of project and dedicated support and follow up. Thanks Mehr

$78 USD in 3 Tagen
(189 Bewertungen)
6.2
ghazalpasha

I'm fluent in C++ and can do this project in 1 or 2 days. Let me know if you have any extra details on the project and the deadline.

$155 USD in 3 Tagen
(1 Bewertung)
2.6
SbStudios

Hello, I'm 7 years experience in PHP and 5 years experience in C/C++, so I can lead this project quickly and reliably. Thank you to hire me :)

$155 USD in 4 Tagen
(0 Bewertungen)
0.0
Buyuk

I have wide experience in area of C++ programming, algorithm design, and artificial intelligence. I have already programmed traditional Game of Life based on Convay's terms, so I have a good view at what a program shou Mehr

$111 USD in 3 Tagen
(0 Bewertungen)
0.0