/* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º º º 36 State Finite Closed Linear Cellular Automation º º º º World 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 RandomWorld true #define MaxColumn 1024 #define WorldTop MaxColumn-1 #define States 8 #define MaxState States-1 typedef char Name[33]; Name WorldFileName; FILE *WorldFile; Byte World[1024]; Word i, j, t; Boolean o; void ClearWorld() { for(i=0; i<=WorldTop; i++) World[i]=0; } void DoRandomWorld() { for(i=0; i<=WorldTop; i++) { if(RandInt(50)==0) World[i]=RandInt(States); else World[i]=0; } } void WriteWorldFile() { WorldFile=fopen(WorldFileName, "wb"); fwrite(World, sizeof(World), 1, WorldFile); fclose(WorldFile); } void main() { clrscr(); printf("Generating World\n"); strcpy(WorldFileName,"WORLD1D.CA"); InitRand(0.4231966); ClearWorld(); if(RandomWorld) DoRandomWorld(); WriteWorldFile(); }