/* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º º º 8 State Finite Closed 2-Dimensional Cellular Automation º º º º Rule File Maker º º º º (c) 1991 Christopher D. Watkins º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ */ #include "stdio.h" #include "dos.h" #include "string.h" #include "defs.h" #include "globals.h" #include "mathb.h" #define States 8 #define MaxState (States-1) typedef char Name[33]; typedef Byte State[8]; typedef Byte Rule[8][8][8][8][8]; Name RuleFileName; FILE *RuleFile; Rule Rules; Word i, j, k, l, m; int x; Byte o; void WriteRuleFile() { fwrite(Rules, sizeof(Rule), 1, RuleFile); fclose(RuleFile); } Byte r; void main() { clrscr(); printf("Generating Rule\n"); strcpy(RuleFileName,"RULE2D.CA"); RuleFile=fopen(RuleFileName, "wb"); for(i=0; i<=MaxState; i++) { for(j=0; j<=MaxState; j++) { for(k=0; k<=MaxState; k++) { for(l=0; l<=MaxState; l++) { for(m=0; m<=MaxState; m++) { r=0; if(i==1) ++r; if(j==1) ++r; if(k==1) ++r; if(l==1) ++r; if(m==1) ++r; x=r; /* if(i==m) x=RandInt(States) else { r=l%3; switch(r) { case 0 : x=i; break; case 1 : x=j; break; case 2 : x=k; break; } } if(j>1) x=l; if(k>1) x=k; if(l>1) x=j; */ /* if(i==0) x=K; else { if(j