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

**This is a C program ** Thank you Use two 2-dimensional arrays of chars (minimu

ID: 3626316 • Letter: #

Question

**This is a C program **
Thank you

Use two 2-dimensional arrays of chars (minimum size: 20 x 40). One array will be the current world, the other will hold the next generation. Each cell in the array holds either a "*" (a live organism) or a blank-- " "--(no organism). The game starts out with an initial generation, which consists of any mix of stars and blanks. This original array will be read in from a text file specified by the user. This file can be created using any text editor, such as notepad (do not use a word processor).

Three rules govern the transition from one generation to the next:

1. Birth Rule: an organism is born into an empty cell that has exactly three living neighbors.
2. Survival Rule: An organism survives from one generation to the next if it has either 2 or 3 living neighbor.
3. Death Rule: An organism dies from loneliness if it has fewer than 2 neighbors. It dies from overcrowding if it has 4 or more neighbors.

In your version of the game, you will display the world one generation at a time. The user will press <Enter> to continue, and some other key to quit.

Make Sure you test fully! Results depend on the initial colony. Some possible results:

* The colony quickly dies out
* The colony rapidly expands (stopped only by the edge of the world).
* the colony reaches a set stasis
* the colony reaches an oscillating stasis (moves back and forth between 2 or more configurations)

The program, of course, should use top-down design, and must utilize modularity designed functions.

Some suggestions for functions you should utilize:

* a function to read the file into the grid
* a function to count the neighbors of any one cell
* a function to calculate the next generation (which should call the previous function)
* a function to print out one generation
* a function to move the next generation to the current one (or swap pointers to the two generations)

Much appreciated.

Explanation / Answer

#include #include void header(void); void survivalRule(char [][20], int, int); void birthRule(char [][20], int, int); void deathRule(char [][20], int, int); int main(void) { char Life[20][20]; int orgs, gens; int i, a, b, row, col; int count = 0; int x = 19; int y = 19; char ans; header(); do{ printf(" Please enter the number of organisms you would like to live in the first generation: "); scanf("%i", &orgs); srand( (unsigned)time( NULL ) ); for(i = 0; i