Professional Documents
Culture Documents
/* */
/* Game of Life */
/* */
/*********************************************************/
#include <stdio.h>
#define SIZE 20
#define MAXNUM 15
#define INBOUNDS (a>=0)&&(a<SIZE)&&(b>=0)&&(b<SIZE)
#define NORESPONSE 1
/*********************************************************/
/* Level 0 */
/*********************************************************/
main ()
{ int count[SIZE][SIZE];
char array[SIZE][SIZE];
int generation = 0;
while (NORESPONSE)
{
CountNeighbours(array,count);
BuildNextGeneration(array,count);
UpdateDisplay(array,++generation);
/**********************************************************/
/* Level 1 */
/**********************************************************/
char array[SIZE][SIZE];
{ int i,j;
char ch;
/********************************************************/
char array[SIZE][SIZE];
int count[SIZE][SIZE];
{ int i,j;
/*******************************************************/
BuildNextGeneration (array,count)
char array[SIZE][SIZE];
int count[SIZE][SIZE];
{ int i,j;
/*******************************************************/
char array[SIZE][SIZE];
int g;
{ int i,j;
/*******************************************************/
/* Level 2 */
/*******************************************************/
numalive (array,i,j)
char array[SIZE][SIZE];
int i,j;
{ int a,b,census;
census = 0;
return (census);
}
/********************************************************/
/* Toolkit input */
/********************************************************/
quit()
{ char ch;
while (NORESPONSE)
{
scanf ("%c",&ch);
if (ch != '\n') skipgarb();
switch (ch)
{
case 'q' : case 'Q' : return (1);
default : return (0);
}
}
}
/********************************************************/
skipgarb ()
{
while (getchar() != '\n')
{
}
}