home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / xplatfrm / tierra / frontend.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-26  |  2.4 KB  |  93 lines

  1. /* frontend.c  28-10-91  Artificial Life simulator frontend routines */
  2. /** Tierra Simulator V3.0: Copyright (c) 1991 Thomas S. Ray **/
  3.  
  4. #include "license.h"
  5.  
  6. /* frontend rationale:  to have a common set of functions for passing info
  7.    from Tierra to the front end.  Any particular front end will likely
  8.    use only a subset of all frontend functions.  Those functions that a
  9.    particular front end does not use, will either have to be implemented
  10.    here as dummy functions, or they will have to be ifdef'ed where they
  11.    are called from Tierra */
  12.  
  13. #ifndef lint
  14. static char     sccsid[] = "%W% %G%";
  15. #endif
  16.  
  17. #include "tierra.h"
  18. #include "extern.h"
  19.  
  20. #if FRONTEND == STDIO  /* STDIO == 0 */
  21.  
  22. void FEStartup() /* called immediately after the soup_in file is read */
  23. {                    /* an opportunity to interactively set soup_in vars */
  24. }
  25.  
  26. void  FEMessage(n)
  27. I8s  n;
  28. {   I8s  i;
  29.  
  30.     for(i = 0; i < n; i++)
  31.         printf("%s\n", mes[i]);
  32.     fflush(stdout);
  33. }
  34.  
  35. void  FEError(n)
  36. I8s  n;
  37. {   I8s  i;
  38.  
  39.     for(i = 0; i < n; i++)
  40.         fprintf(stderr, "%s\n", mes[i]);
  41.     fflush(stderr);
  42. }
  43.  
  44. void  FEPlan(MaxPop, MaxMem, MaxGenPop, MaxGenMem)
  45. I32s  MaxPop, MaxMem;
  46. struct genotype  *MaxGenPop, *MaxGenMem;
  47. {   long int  tp;
  48.  
  49.     tp = time(NULL);
  50.     printf("InstExeC = %ld  Generations = %.0f  NumCells = %ld  %s",
  51.         InstExe.m, Generations, NumCells, ctime(&tp));
  52.     if (InstExe.m)
  53.         printf("    births = %ld  deaths = %ld  AvgPop = %.0f  \
  54.             AvgSize = %ld\n", TimeBirth, TimeDeath, TimePop, AverageSize);
  55.     printf("    RateMut = %ld  RateMovMut = %ld  RateFlaw = %ld\n",
  56.         RateMut, RateMovMut, RateFlaw);
  57.     printf("    num_gen = %ld  num_genq = %ld  num_genl = %ld  \
  58.         AverageSize = %ld\n", num_gen, num_genq, num_genl, AverageSize);
  59.     if (GeneBnker && InstExe.m)
  60.         printf("    MaxGenPop = %ld%s = %ld  MaxGenMem = %ld%s = %ld\n",
  61.             MaxGenPop->size, MaxGenPop->label, MaxPop,
  62.             MaxGenMem->size, MaxGenMem->label, MaxMem / MaxGenMem->size);
  63.     fflush(stdout);
  64. }
  65.  
  66. #endif /* FRONTEND == STDIO == 0 */
  67.  
  68.  
  69. #if FRONTEND == GREENLEAF  /* GREENLEAF == 1 */
  70.  
  71. void FEStartup()
  72. {   ;
  73. }
  74.  
  75. void  FEMessage(n)
  76. I8s  n;
  77. {
  78. }
  79.  
  80. void  FEError(n)
  81. I8s  n;
  82. {
  83. }
  84.  
  85. void  FEPlan(MaxPop, MaxMem, MaxGenPop, MaxGenMem)
  86. I32s  MaxPop, MaxMem;
  87. struct genotype  *MaxGenPop, *MaxGenMem;
  88. {
  89. }
  90.  
  91. #endif /* FRONTEND == GREENLEAF == 1 */
  92.  
  93.