please help asap a simple c program conway 39 s game of life this c file will need t 5153186

Please HELP ASAP!!!!

A simple c program,

Conway's Game of Life

This C file will need to read a file name and a number of time steps N from the command line to get the simulation's initial state. For coding this assignment, you can assume a fixed size to the grid: 30 rows and 50 columns. Once the initial state has been read, you will run the simulation for N steps, and finally write the output state to a file. An optional command line argument, -p , may be the first argument. If this argument is present, you will call a function to print the state of the grid to standard output at the end of every time step. you will be required to use good practices when creating your program.


At minimum, your program will need to have the following functions (besides

main() ):

– A function to read a file and create the initial state (note that in addition to fgets() , which gets a line at a time from a file, you may find fgetc() , which gets a single character at a time from a file, to be useful)

–  A function to take the final grid and write it to a file as output

–  A function to get the number of neighbours (and thus, the future condition) of a cell, given the grid and the cell's index

–  A function to print the grid

You will also need to consider carefully how many grids your program will need, and how to “switch” between them. Think also about the data type you will use for the simulation: the file you read in will contain characters, and you must print out the grid as characters, but there may be a data type that makes coding the simulation easier. Another consideration is whether you wish to deal with manipulating the grid as a 1D or 2D array: as seen in lecture, a 2D array can be recast and interpreted as a 1D array.

– Running the command make on your files will compile a runnable executable, without errors or warnings. You must compile with the -Wall and -Wextra flags.

– Your C program is well-documented, with descriptions of functions and inline comments where needed.

"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now