home *** CD-ROM | disk | FTP | other *** search
- /* frontend.c 28-10-91 Artificial Life simulator frontend routines */
- /** Tierra Simulator V3.0: Copyright (c) 1991 Thomas S. Ray **/
-
- #include "license.h"
-
- /* frontend rationale: to have a common set of functions for passing info
- from Tierra to the front end. Any particular front end will likely
- use only a subset of all frontend functions. Those functions that a
- particular front end does not use, will either have to be implemented
- here as dummy functions, or they will have to be ifdef'ed where they
- are called from Tierra */
-
- #ifndef lint
- static char sccsid[] = "%W% %G%";
- #endif
-
- #include "tierra.h"
- #include "extern.h"
-
- #if FRONTEND == STDIO /* STDIO == 0 */
-
- void FEStartup() /* called immediately after the soup_in file is read */
- { /* an opportunity to interactively set soup_in vars */
- }
-
- void FEMessage(n)
- I8s n;
- { I8s i;
-
- for(i = 0; i < n; i++)
- printf("%s\n", mes[i]);
- fflush(stdout);
- }
-
- void FEError(n)
- I8s n;
- { I8s i;
-
- for(i = 0; i < n; i++)
- fprintf(stderr, "%s\n", mes[i]);
- fflush(stderr);
- }
-
- void FEPlan(MaxPop, MaxMem, MaxGenPop, MaxGenMem)
- I32s MaxPop, MaxMem;
- struct genotype *MaxGenPop, *MaxGenMem;
- { long int tp;
-
- tp = time(NULL);
- printf("InstExeC = %ld Generations = %.0f NumCells = %ld %s",
- InstExe.m, Generations, NumCells, ctime(&tp));
- if (InstExe.m)
- printf(" births = %ld deaths = %ld AvgPop = %.0f \
- AvgSize = %ld\n", TimeBirth, TimeDeath, TimePop, AverageSize);
- printf(" RateMut = %ld RateMovMut = %ld RateFlaw = %ld\n",
- RateMut, RateMovMut, RateFlaw);
- printf(" num_gen = %ld num_genq = %ld num_genl = %ld \
- AverageSize = %ld\n", num_gen, num_genq, num_genl, AverageSize);
- if (GeneBnker && InstExe.m)
- printf(" MaxGenPop = %ld%s = %ld MaxGenMem = %ld%s = %ld\n",
- MaxGenPop->size, MaxGenPop->label, MaxPop,
- MaxGenMem->size, MaxGenMem->label, MaxMem / MaxGenMem->size);
- fflush(stdout);
- }
-
- #endif /* FRONTEND == STDIO == 0 */
-
-
- #if FRONTEND == GREENLEAF /* GREENLEAF == 1 */
-
- void FEStartup()
- { ;
- }
-
- void FEMessage(n)
- I8s n;
- {
- }
-
- void FEError(n)
- I8s n;
- {
- }
-
- void FEPlan(MaxPop, MaxMem, MaxGenPop, MaxGenMem)
- I32s MaxPop, MaxMem;
- struct genotype *MaxGenPop, *MaxGenMem;
- {
- }
-
- #endif /* FRONTEND == GREENLEAF == 1 */
-
-