I am trying (unsuccessfully!) to code the game of life for an assignment, I am very new to C programming and am finding it very difficult.
I am at the part where the program needs to count how many cells are live/dead and I thought it would be a good idea to surround the initial matrix with 0's in order to count the dead/live cells at the edge.
can anyone help me do this?
My initial matrix is generated as below, after many user inputs:
printf("Initial matrix :\n");
for (i=1; i<=n; i++)
{
for (j=1; j<=p; j++)
{
/*Begins loop to fill the matrix with 0's and 1's*/
v[i][j] = rand()%2;
printf("%d\t", v[i][j]);
}
/*Prints the matrix, 1's for live cells and 0 for dead cells, with the title initial matrix*/
printf("\n");
}
Thanks in advance.