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

Answer correctally for 5000 pts. First ever question and last project of CS clas

ID: 661254 • Letter: A

Question

Answer correctally for 5000 pts. First ever question and last project of CS class. You must match the FINAL CORRECT GRID OUTPUT that has been provided. No one has been able to do it so far. 5000 points but it must be done in 5 hours from now, that's 11PM PST. Thank you!

C++ and in text format please

Two-dimensional array operations: Game of Life program

The game of life is a computer simulation of the life and death events of a population of organisms. This program will determine the life, death, and survival of bacteria from one generation to the next, assuming the starting grid of bacteria is generation zero (0). Each cell has a total of up to 8 neighbors, including the 4 immediately adjacent cells and the 4 diagonal cells. The rules for the creation of each cell in the next generation are as follows:

If the cell is currently empty:

If the cell has exactly three living neighbors, it will come to life in the next generation.

If the cell has any other number of living neighbors, it will remain empty.

If the cell is currently living:

If the cell has one or zero living neighbors, it will die of loneliness in the next generation.

If the cell has four or more living neighbors, it will die of overcrowding in the next generation.

If the cell has two or three neighbors, it will remain living.

All births and deaths occur simultaneously (make sure you don't get this one wrong!).

First check the following html links that provide context and visual content of data related to this project:  initial grid data, grid output including intermediate generations and final correct grid output.

Your task is to write a program that plays the game of life. The size of the grid will be a 20 x 20 square. Your solution must use a 20 X 20 two-dimensional array. Don't declare a bigger array! It is permissible, of course, to use a second array of the same size if you find it convenient or helpful to do so.

A "Game_of_life" class (ADT) set-up and implementation is possible but is not required. DO NOT use pointers or vectors for this project.

The original grid of bacteria will be supplied to your program from a text file called bacteria.txt. The text file will contain one line of data for each bacteria in the original grid. Each line will consist of a pair of numbers, separated by a space. The first number will indicate the row location of the bacteria and the second number will indicate the column location of the bacteria. Every number in the text file will be between 0 and 19.

After your program has initialized the grid with generation 0, your program must use the criteria provided above and allow life to proceed for 5 generations. Your program should then display the final results for the fifth generation on the screen, using asterisks (*) to represent live bacteria on a grid, along with the following statistical information:

The number of living cells in row 10.

The number of living cells in column 10.

The number of dead cells in row 16.

The number of dead cells in column 1.

The number of living cells in the entire board.

The number of dead cells in the entire board.

*note ...row 10 and column 10 refers to the actual row and column indexes in the 20 x 20 two-dimensional array

Please make sure that you use the following input file bacteria.txt and make sure your output matches the final correct grid output exactly. You may use the following visual grid output including intermediate generations as you code and test your grid data and output. Note: Do not worry if your compiled version of grid output pasted in the text box below appears a bit skewed in the confirmation email. I will be compiling your submitted source code and so should see the correctly formatted grid.

bacteria.txt:

GRID OUTLINE INCLUDING INTERMEDIATE GENERATIONS

FINAL CORRECT GRID OUTPUT:

Please help me asap.This is my last project and I am willing to give anyone who answeres this correctly in C++ before tomorrow night all of my points. I have never asked a question here before. I need this done my 5/15/15 around 5PST. I have seen similar questions asked here before but it seems no one has given the full question and no one has been able to come up with the acutall final correct grid output. This is my last project and I am willing to give anyone who answeres this correctly before tomorrow night all of my points. Thank you so much!

PS: If there is anything you need me to clear up about this question I would be happy to any time. Just post a comment and I will give you any information you need to help you with answering this question.

Explanation / Answer

#include #include using namespace std; const int MAX_LENGTH = 20; int loadFile(int bacteria[MAX_LENGTH][MAX_LENGTH]) { ifstream infile("bacteria.txt"); if(infile.is_open()) { int row = -1, col = -1; while(infile>> row >> col) { if(row==-1 || col== -1)break; else { bacteria[row][col] = 1; } } infile.close(); return 0; } return -1; } void printGrid(int bacterai[MAX_LENGTH][MAX_LENGTH]) { cout