/* * GENESIS Copyright (c) 1986, 1990 by John J. Grefenstette * This program may be freely copied for educational * and research purposes. All other rights reserved. * * file: schema.c * * purpose: measure the current allocation of trials to a schema * and record the results in Schemafile. * * modified: 13 feb 86 * * 12 nov 86: pass Length to Unpack() * * 10 sep 90: print statistics in display mode */ #include "extern.h" #define DISPSCH 9 Schema() { int i; double expected; double perf; int count; static int lastcount = 1; char msg[40]; int ok; static int firstflag = 1; static int firstcount = 1; FILE *fopen(); static FILE *fp; int j; char tmp; static char *S; Trace("Schema entered"); Dtrace("schema"); if (firstflag) { /* initialize schema S from schemafile */ S = malloc((unsigned) (Length + 1)); if ((fp = fopen(Schemafile, "r")) == NULL) { sprintf(msg, "Schema: can't open %s", Schemafile); Error(msg); } for (i=0; i