you will build a simple version of conway 39 s game of life multifile development fo 5149976
you will build a simple version of Conway's Game of Life.
multifile development for this question. You should split your code between at least 3 files: a file containing your main function and things like argument checking, and then at least two other .c files and matching .h files of your choice. Try to think of a logical way to divide your code: for example, the two file-related functions may be a good choice to separate from the other code. You will be marked on the logic of your design decisions.
This assignment will have you 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 le. 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. First, you will create an SVN repository, commit your files there, and turn in a log of your SVN activity, a4 svn log.txt , at the end of development.
You are also required to have a makefile for your code with rules to make your executable and object files, a rule to clean your project, and a rule to test your program.
Design
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.
– Your program has a multifile structure, and the divisions between the files makes sense.
the test files are in the google link provided
https://drive.google.com/open?id=1JFtQs7mZZCxxKz6tyr8MDylv92DKdlVT