//life.cpp //(c) 1997, Oguz Yetkin //physics 505 // //Game of life, and other good stuff //#include "graph.h" #include //will have to use borland c++ graphics directly :( //for getpixel and putpixel #include #include #include #include //for exit const int GEN=2; const int I=70; const int J=70; const int offset=20; //offset to plot //const int ITER=300; inline int fate(int value,int num_neighbors); //return 0 or 1 inline int count_neighbor(int array[GEN][I][J], int i, int j,int gen); //assume I and J there int main(int argc, char** argv){ int world[GEN][I][J]; //2 2-d arrays in a 3-d array int world2[GEN][I][J]; //parallel universe int gen=0; //either 0 or 1 int iter=0; int curr_generation=0; int maxcolor; long int i,j,k; //for iterating up to millions char ch; cout<<"\nLife 1.0, by Oguz Yetkin, oguz@writeme.com"; cout<<"\npress q to stop the program"; cout<<"\nThis is a straighforward implementation of LIFE,"; cout<<"\nThe code is probably on"; cout<<"\nhttp://www.cs.wisc.edu/~yetkin/code\n"<>iter; int maxx,maxy; //initialize graphics //************************************ int driver=DETECT; int mode; registerbgidriver(EGAVGA_driver); //int maxx, maxy; //will be 640x480 //**************INIT GRAPHICS********************** initgraph(&driver, &mode, ""); //driver linked in //mode=CGAC0; //initgraph(&driver, &mode,"h:\\borlandc\\bgi"); maxx=getmaxx(); maxy=getmaxy(); maxcolor=getmaxcolor(); //cout<