Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The starter code that is talked about: /* * C program for Conway's ``game of life''. * * Command-line arguments specify input file and number
The starter code that is talked about:
/* * C program for Conway's ``game of life''. * * Command-line arguments specify input file and number of steps. * * Input file contains a representation of an initial board configuration: * N (size of board) and N*N values (each 0 or 1). */ #include#include #include #include /* * builds 2D array in form of an array of pointers into one big 1D array. * return value is array of pointers, or NULL if there was a problem * (in which case the function prints a suitable error message). */ bool **build2D(long size); /* * frees 2D array, built as in build2D(). */ void free2D(long size, bool **array2D); /* * reads initial board configuration from file. * builds 2D array in form of an array of pointers into one big 1D array. * parameters: * infile is an already-opened file. * (out) *size_p is board size * return value is array of pointers, or NULL if there was a problem * (in which case the function prints a suitable error message). */ bool **read_board(FILE* infile, long *size_p); /* * generates new board configuration from old. */ void update_board(long size, bool **old_board, bool **new_board); /* * prints board. */ void print_board(long size, bool **board); /* * main program */ int main(int argc, char* argv[]) { /* process command-line arguments */ if (argc != 3) { fprintf(stderr, "parameters; infile num_steps "); return EXIT_FAILURE; } FILE* infile = fopen(argv[1], "r"); if (infile == NULL) { fprintf(stderr, "unable to open input file %s ", argv[1]); return EXIT_FAILURE; } char* end_ptr_for_strtol; long steps = strtol(argv[2], &end_ptr_for_strtol, 10); if ((*end_ptr_for_strtol != '\0') || (steps 1. (20 points) Your mission for this assignment is to first complete and then modify a starter program that plays mathematician John Conway's "Game of Life", described below. (You can also find more information on the Web. The Wikipedia article seems good.) The Game of Life is not so much a game in the usual sense as a set of rules for something called a cellular automaton: There are no players, and once the initial configuration is established, everything that happens is determined by the game's rules. The game is played" on a board consisting of a rectangular grid of cells. Some cells are "live" (contain a simulated organism); others are *dead" (empty). At each step, a new configuration is computed from the old configuration according to the following rules
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started