Question: Code in C . Design Based on the requirements it looks like we can take a simple procedural approach and break down the task into
Code in C Design
Based on the requirements it looks like we can take a simple procedural approach and break
down the task into a sequence of subtasks or procedures, along with whatever data structures
are needed. To find the subtasks it can help to write down the steps in 'pseudocode' and repeat
this process, refining each step into greater detail. When working on the details of a subtask, it
helps to sketch diagrams of what your program will need to do so that you can get some insight
into how to solve the tricky parts.
Implementation
The program will be written in C Try to write your program incrementally by first creating the
overall structure with empty functions stubs and testing often to see that your program is
always working as expected. The entire program will be in a single file, called life.c and that is
what you will submit. Testing
When testing, you are checking to see that the program satisfies the requirements. Test to see
that each generation is properly displayed. Remember that when moving through the stages of
requirements, design, implementation and testing, it is often necessary to go back to a previous
stage and revisit decisions and make changes; software development is iterative.
Welcome! Press q to quit or any other key to continue:
X
Enter the offsets for the live cells:
generation :
generation :generation :
generation :
generation :
generation :
generation :
generation :
generation :
Good life!
Press q to quit or any other key to continue:
q
Bye Bye!
The Game of Life
The Game of Life, also known simply as Life, is a cellular automaton devised by the
mathematician John Conway in It is a zeroplayer game, meaning that its evolution is
determined by its initial state, requiring no further input. One interacts with the Game of Life by
creating an initial configuration and observing how it evolves.
The universe of the Game of Life is an infinite, twodimensional orthogonal grid of square cells,
each of which is in one of two possible states, live or dead or populated and unpopulated,
respectively Every cell interacts with its eight neighbors, which are the cells that are
horizontally, vertically, or diagonally adjacent. At each step in time, the following two rules are
applied to every cell:
Any live cell with fewer than two or more than live neighbors dies.
Any dead cell with exactly three live neighbors becomes a live cell.
The initial pattern constitutes the seed of the system. The first generation is created by applying
the above rules simultaneously to every cell in the seed, live or dead; births and deaths occur
simultaneously, and the discrete moment at which this happens is sometimes called a tick. Each
generation is a pure function of the preceding one. The rules continue to be applied repeatedly
to create further generations.
Requirements
A program is needed to allow a user to set an initial configuration for a grid of cells and then
display its evolution for generations where the initial configuration is generation and the last
is generation The user is prompted for an initial configuration and enters it as a comma
separted list of integers where each integer is an offset into the grid as a linear array in which
the first element, is at the top left, ie See the sample run below.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
