home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume06 / rndweat.her < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  38.3 KB

  1. From decwrl!ucbvax!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!uunet!allbery Sat Mar 25 19:44:38 PST 1989
  2. Article 849 of comp.sources.misc:
  3. Path: decwrl!ucbvax!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v06i080: Random Weather Generator for RPGs
  7. Message-ID: <51485@uunet.UU.NET>
  8. Date: 25 Mar 89 17:03:53 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: slocum@hi-csc.UUCP
  11. Lines: 1334
  12. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  13.  
  14. Posting-number: Volume 6, Issue 80
  15. Submitted-by: slocum@hi-csc.UUCP
  16. Archive-name: rndweather
  17.  
  18. This is a random weather generator for use with roleplaying games.
  19. It is customizable, and contains several different climates and
  20. calendars.  See README file for for info.  See Makefile for
  21. instructions on making various versions.
  22.  
  23. Brett Slocum   UUCP: ...uunet!hi-csc!slocum
  24.                Arpa: hi-csc!slocum@uunet.uu.net
  25. "My name is Inigo Montoya. You killed my father. Prepare to die."
  26.  
  27. #--------------------------------CUT HERE-------------------------------------
  28.  
  29.  
  30. # This is a shell archive.  Remove anything before this line, then
  31. # unpack it by saving it in a file and typing "sh file".  (Files
  32. # unpacked will be owned by you and have default permissions.)
  33. #
  34. # This archive contains:
  35. # README Makefile weather.c gregorian.h gulf.h japan.h mid_atlantic.h middle_earth.h n_atlantic.h n_pacific.h s_atlantic.h weather.h
  36.  
  37. echo x - README
  38. cat > "README" << '//E*O*F README//'
  39. When playing roleplaying games (RPGs), it often adds some realism if the GM
  40. can determine what kind of weather is occuring.  This program generates random
  41. weather for a year that is tunable to various climates.  Several example
  42. climates are included: north, south, and mid atlantic, gulf, and north
  43. pacific.
  44.  
  45. In addition, several different calendars are included: Gregorian, medieval
  46. Japanese, and the Middle Earth calendar detailed in the appendices of
  47. Tolkien's The Lord of the Rings.
  48.  
  49. The details of these are provided so that the user can create his or her own
  50. climate profiles or calendars.
  51.  
  52. Please send any improvements, new climate profiles, new calendars, or
  53. better versions of the current climate profiles to one of the addresses below.
  54.  
  55. -----------------------------------------------------------------
  56. Brett Slocum   UUCP: ...uunet!hi-csc!slocum
  57.                Arpa: hi-csc!slocum@uunet.uu.net
  58. "My name is Inigo Montoya. You killed my father. Prepare to die."
  59. -----------------------------------------------------------------
  60.  
  61. //E*O*F README//
  62.  
  63. echo x - Makefile
  64. cat > "Makefile" << '//E*O*F Makefile//'
  65. # Makefile: makefile for weather.c
  66. # make <choice>
  67. # will create a specific climate program.
  68. #
  69. # make
  70. # will create 'england', an English climate program.
  71. #
  72. # make all
  73. # will create all climate programs.
  74. #
  75. # To make addition climate programs, just add the calendar
  76. # and climate choices as -D options.
  77. #
  78. # Calendar choices:
  79. # GREGORIAN - uses essentially modern calendar, without leap years.
  80. #
  81. # JAPAN     - uses medieval Japanese calendar.
  82. #
  83. # MIDDLE_EARTH - uses calendar described in appendices of Tolkien's
  84. #                'The Lord of the Rings'.
  85. #
  86. # Climate choices:
  87. #
  88. # N_ATLANTIC   - useful for Scandinavia coastal or interior continential US
  89. #                or Europe.
  90. # MID_ATLANTIC - useful for England, European coastal, New England, etc.
  91. # S_ATLANTIC   - useful for Spain, Southern coastal US
  92. # GULF         - useful for Gulf States, Mediterranean, etc.
  93. # N_PACIFIC    - useful for Japan, Korea, Southern Alaskan coast, etc.
  94.  
  95. england: weather.c weather.h gregorian.h mid_atlantic.h
  96.     cc -DGREGORIAN -DMID_ATLANTIC -o england -g weather.c
  97.  
  98. minnesota: weather.c weather.h gregorian.h n_atlantic.h
  99.     cc -DGREGORIAN -DN_ATLANTIC -o minnesota -g weather.c
  100.  
  101. japan: weather.c weather.h japan.h n_pacific.h
  102.     cc -DJAPAN -DN_PACIFIC -o japan -g weather.c
  103.  
  104. florida: weather.c weather.h gregorian.h gulf.h
  105.     cc -DGREGORIAN -DGULF -o florida -g weather.c
  106.  
  107. shire: weather.c weather.h middle_earth.h mid_atlantic.h
  108.     cc -DMIDDLE_EARTH -DMID_ATLANTIC -o shire -g weather.c
  109.  
  110. georgia: weather.c weather.h gregorian.h s_atlantic.h
  111.     cc -DGREGORIAN -DS_ATLANTIC -o georgia -g weather.c
  112.  
  113. all: england minnesota japan florida shire georgia
  114.  
  115. //E*O*F Makefile//
  116.  
  117. echo x - weather.c
  118. cat > "weather.c" << '//E*O*F weather.c//'
  119. /**************************************************************************
  120.  *  Weather - generates random weather                                    *
  121.  *                                                                        *
  122.  *  Copyright 1988 by Brett Slocum.  All rights reserved.                 *
  123.  *  Permission is granted to distribute or modify this program, or use    *
  124.  *  portions of this program in other programs, as long as this notice    *
  125.  *  remains intact.                                                       *
  126.  *  This program or its derivatives may not be sold for profit without    *
  127.  *  permission of the author.                                             *
  128.  *                                                                        *
  129.  *  Original UNIX Version: Brett Slocum UUCP: ...uunet!hi-csc!slocum      *
  130.  *                                      ARPA: hi-csc!slocum@uunet.uu.net  *
  131.  *                                                                        *
  132.  **************************************************************************/
  133.  
  134. #include "weather.h"
  135.  
  136. typedef UBYTE MONTH_T;
  137.  
  138. /* Calendar choices */
  139. #ifdef GREGORIAN
  140. #include "gregorian.h"
  141. #else
  142. #ifdef JAPAN
  143. #include "japan.h"
  144. #else
  145. #ifdef MIDDLE_EARTH
  146. #include "middle_earth.h"
  147. #endif
  148. #endif
  149. #endif
  150.  
  151. /* Climate choices */
  152. #ifdef N_ATLANTIC
  153. #include "n_atlantic.h"
  154. #else
  155. #ifdef MID_ATLANTIC
  156. #include "mid_atlantic.h"
  157. #else
  158. #ifdef S_ATLANTIC
  159. #include "s_atlantic.h"
  160. #else
  161. #ifdef GULF
  162. #include "gulf.h"
  163. #else
  164. #ifdef N_PACIFIC
  165. #include "n_pacific.h"
  166. #endif
  167. #endif
  168. #endif
  169. #endif
  170. #endif
  171.  
  172. UBYTE Stat_Table[N_MONTHS][N_STAT] = {
  173.     {200,0,0}, {200,0,0}, {200,0,0}, {200,0,0}, {200,0,0}, {200,0,0}, 
  174.     {200,0,0}, {200,0,0}, {200,0,0}, {200,0,0}, {200,0,0}, {200,0,0}
  175. };
  176.  
  177. WIND_T     Wind = CALM;          /* today's wind conditions */
  178. TEMP_T     Temp_Class = CHILLY;  /* today's temperature class */
  179. PRECIP_T   Precip_Class = NONE;  /* today's precipitation */
  180. WEATHER_T  Weather;              /* today's weather */
  181. OVERCAST_T Sky;                  /* today's sky conditions */
  182.  
  183. UBYTE Temperature = 0,           /* today's actual temperature */
  184.       Duration = 0;              /* today's precipitation duration */
  185.  
  186. BOOL Duration_Hours = TRUE,      /* flag that indicates whether precip lasted */
  187.                                  /* hours (TRUE) or minutes (FALSE) */
  188.      Catastrophe = FALSE,        /* flag that indicates whether a catastrophe */
  189.                                  /* occurred today */
  190.      Storm = FALSE,              /* flag that indicates whether precip was a storm */
  191.      Long_Storm = FALSE,         /* flag that indicates whether precip was a */
  192.                                  /* long storm lasting more than one day */
  193.      Snow = FALSE;               /* flag that indicates whether snow fell today */
  194.  
  195. float Rainfall = 0.0,            /* yearly total rainfall */
  196.       Snowfall = 0.0,            /* yearly total snowfall */
  197.       Snow_Depth = 0.0;          /* today's snow depth, including new accumulations */
  198.                                  /* and melting */
  199.  
  200. WEATHER_T 
  201. gen_weather(month, ptr_catastrophe)
  202.     MONTH_T month;
  203.     BOOL *ptr_catastrophe;
  204.     /* This routine generates the overall weather for the day. */
  205.     /* It also determines whether a catastrophe has occurred.  */
  206.     /* A catastrophe can be localized or wide-spread, natural  */
  207.     /* or man-made. Such things as fires, earthquakes, floods, */
  208.     /* etc. are possible.                                      */
  209. {
  210.      int       roll;
  211.      WEATHER_T i, 
  212.                return_val;
  213.  
  214.      /* get die-roll.  if catastrophe, set flag and roll again. */
  215.      do {  
  216.          roll = DIE(100);
  217.          if (roll == 100)
  218.              *ptr_catastrophe = TRUE;
  219.      }
  220.      while (roll == 100);
  221.  
  222.      /* if it rained more than a sprinkle yesterday, it more likely */
  223.      /* to be at least overcast, if not rainy today. */
  224.      if (Precip_Class > SPRINKLE) {
  225.          roll = roll - 10;
  226.          if (roll < 1)
  227.              roll = 1;
  228.      }
  229.  
  230.      /* find the type of weather from the die-roll */
  231.      return_val = CLEAR;
  232.      for (i = CLEAR; i >= PRECIPITATION; i--)
  233.          if (roll <= Weather_Table[month][i])
  234.              return_val = i;
  235.      return(return_val);
  236. }
  237.  
  238. TEMP_T 
  239. gen_temp(month)
  240.     MONTH_T month;
  241.     /* generates the day's temperature and set the temp type */
  242. {
  243.      int roll, data, i;
  244.      TEMP_T return_val;
  245.  
  246.      /* determine temperature variation from monthly average */
  247.      /*   +/- 20 degrees */
  248.      roll = DIE(100);
  249.      data = 8;
  250.      for (i = 8; i >= 0; i--)
  251.          if (roll <= Temp_Variation[i])
  252.              data = i;
  253.      Temperature = Ave_Temp[month] + ((data-4) * 5);
  254.  
  255.      /* classify the temperature class */
  256.      if (Temperature < 25) 
  257.          return_val = COLD;
  258.      else
  259.      if ((Temperature >= 25) AND (Temperature < 40)) 
  260.          return_val = CHILLY;
  261.      else
  262.      if ((Temperature >= 40) AND (Temperature < 65)) 
  263.          return_val = FAIR;
  264.      else
  265.      if ((Temperature >= 65) AND (Temperature < 80)) 
  266.          return_val = WARM;
  267.      else
  268.      if (Temperature >= 80) 
  269.          return_val = HOT;
  270.  
  271.      /* accumulate monthly statistics */
  272.      Stat_Table[month][HIGH] = MAX(Temperature, Stat_Table[month][HIGH]);
  273.      Stat_Table[month][LOW] = MIN(Temperature, Stat_Table[month][LOW]);
  274.      return(return_val);
  275. }
  276.  
  277. WIND_T
  278. gen_wind(month)
  279.     MONTH_T month;
  280.     /* generate the wind class */
  281. {
  282.      int roll;
  283.      WIND_T return_val, i;
  284.  
  285.      /* modify the roll for current weather.  Clear weather is less likely */
  286.      /* to be windy, and rainy weather is more likely. */
  287.      roll = DIE(100);
  288.      switch (Weather) {
  289.      case CLEAR : 
  290.          roll -= 20;
  291.          break;
  292.      case PRECIPITATION:
  293.          roll += 20;
  294.          break;
  295.      } /* switch */
  296.  
  297.      /* if yesterday was very windy, today will be windier */
  298.      if (Wind >= BLUSTERY) 
  299.          roll += 20;
  300.  
  301.      /* limit to boundaries 1-100 */
  302.      if (roll < 1) 
  303.          roll = 1;
  304.      if (roll > 100) 
  305.          roll = 100;
  306.  
  307.      /* find wind type */
  308.      return_val = GALE;
  309.      for (i = GALE; i >= CALM; i--)
  310.          if (roll <= Wind_Table[month][i]) 
  311.              return_val = i;
  312.      if (Weather == TAIFUN) 
  313.          return_val = GALE;
  314.      return(return_val);
  315.  }
  316.  
  317. PRECIP_T
  318. gen_precip(month)
  319.     MONTH_T month;
  320.     /* generate today's precipitation */
  321. {
  322.      int roll;
  323.      PRECIP_T return_val, i;
  324.  
  325.      return_val = NONE;
  326.      if (Weather == PRECIPITATION)
  327.      {
  328.          roll = DIE(100);
  329.          return_val = STEADY;
  330.          for (i = STEADY; i >= SPRINKLE; i--)
  331.              if (roll <= Precip_Table[month][i])
  332.                  return_val = i;
  333.      }
  334.  
  335.      /* if yesterday had steady precipitation, there is a 1/3 chance */ 
  336.      /* on the second day and 1/6 chance on succeeding days that today */
  337.      /* also has steady precipitation */
  338.      if ((Precip_Class == STEADY) AND (DIE(6) <= 2 - Long_Storm))
  339.      {
  340.          Weather = PRECIPITATION;
  341.          return_val = STEADY;
  342.      }
  343.  
  344.      return(return_val);
  345. }
  346.  
  347. void
  348. precip_statistics()
  349.      /* determines various flags including Snow, Storm and Long_Storm. */
  350.      /* Also determines precipitation duration and amount, updates */
  351.      /* yearly Rainfall and Snowfall statistics, daily Snow_Depth, */
  352.      /* and snow melting */
  353. {
  354.      float amount;
  355.  
  356.      if (Weather == PRECIPITATION)
  357.      {
  358.          /* set flags */
  359.          if (Precip_Class != STEADY) 
  360.              Long_Storm = FALSE;
  361.          if (Temperature < 35)
  362.              Snow = TRUE;
  363.          else
  364.              Snow = FALSE;
  365.          if ((Temp_Class >= WARM) AND ((Precip_Class == SHOWER) OR (Precip_Class == HEAVY)))
  366.              Storm = TRUE;
  367.          else
  368.              Storm = FALSE;
  369.          if (Snow AND (Precip_Class >= HEAVY) AND (Wind >= BLUSTERY))
  370.              Storm = TRUE;
  371.  
  372.          /* determine duration and amount of precipitation */
  373.          switch (Precip_Class) {
  374.          case SPRINKLE :
  375.              Duration = 5 * DIE(6);
  376.              Duration_Hours = FALSE;
  377.              amount = 0.1;
  378.              break;
  379.          case SHOWER :
  380.              Duration = 10 * (DIE(6) + DIE(6));
  381.              Duration_Hours = FALSE;
  382.              amount = Duration / 100;
  383.              break;
  384.          case HEAVY : 
  385.              Duration = 1 + DIE(6);
  386.              Duration_Hours = TRUE;
  387.              amount = (DIE(4) + (Storm * Duration));
  388.              break;
  389.          case STEADY :
  390.              Duration = 24;
  391.              Duration_Hours = TRUE;
  392.              amount = (DIE(6) + DIE(6)) + (Storm * (DIE(6) + DIE(6))); 
  393.              break;
  394.          }
  395.          if (Storm)
  396.              amount *= 2.0;
  397.  
  398.          /* update yearly and daily statistics */
  399.          Rainfall += (amount / 10);
  400.          if (Snow)
  401.              {
  402.                  Snow_Depth += amount;
  403.                  Snowfall += amount;
  404.              }
  405.          else
  406.              switch (Precip_Class) {
  407.              case SHOWER : 
  408.                  Snow_Depth -= Duration / 60;
  409.                  break;
  410.              case HEAVY : 
  411.                  Snow_Depth -= Duration;
  412.                  break;
  413.              case STEADY :
  414.                  Snow_Depth -= 12;
  415.                  break;
  416.              }
  417.      }
  418.  
  419.      /* melt snow in weather above freezing */
  420.      switch (Temp_Class) {
  421.      case CHILLY :
  422.          if (Temperature > 32) 
  423.              Snow_Depth -= 1.0;
  424.          break;
  425.      case FAIR :
  426.          Snow_Depth -= Temperature / 8;
  427.          break;
  428.      case WARM :
  429.          Snow_Depth -= Temperature - 40;
  430.          break;
  431.      case HOT : 
  432.          Snow_Depth -= Temperature - 20;
  433.          break;
  434.      }
  435.      if (Snow_Depth < 0.1)
  436.          Snow_Depth = 0.0;
  437. }
  438.  
  439. OVERCAST_T
  440. gen_overcast(weather)
  441.     WEATHER_T weather;
  442.     /* generate today's level of cloudiness */
  443. {
  444.      int roll;
  445.      OVERCAST_T return_val, i;
  446.  
  447.      return_val = CLOUDY;
  448.      switch (weather) {
  449.      case PRECIPITATION:
  450.      case OVERCAST :
  451.           roll = DIE(100);
  452.           return_val = CLOUDY;
  453.           for (i = CLOUDY; i >= HEAVY_FOG; i--)
  454.               if (roll <= Overcast_Table[i])
  455.                   return_val = i;
  456.           break;
  457.      case TAIFUN : return_val = CLOUDY;
  458.      }
  459.      return(return_val);
  460. }
  461.  
  462. void
  463. print_notes(day, month)
  464.     UBYTE day;
  465.     MONTH_T month;
  466.     /* print snow depth, precipitation type and duration, */
  467.     /* catastrophe, and holidays */
  468. {
  469.      char *precip,
  470.           *dur;
  471.  
  472.      if (Precip_Class != NONE) 
  473.      {
  474.          if (Snow) 
  475.              precip = (Storm ? "Blizzard" : "Snow");
  476.          else
  477.              precip = (Storm ? "Storm" : "Rain");
  478.          dur = (Duration_Hours ? "hours" : "minutes");
  479.          printf(" %s - %2d %s,", precip, Duration, dur);
  480.      }
  481.      if (Catastrophe)
  482.          printf(" Catastrophe,");
  483.      print_holiday(day, month);
  484. }
  485.  
  486. void
  487. print_weather(day, month)
  488.     UBYTE day;
  489.     MONTH_T month;
  490.     /* print today's weather */
  491. {
  492.      printf("%4d  %13s", day, Weather_Name[Weather]);
  493.      printf("%11s", ((Weather==CLEAR) ? "Clear" : Overcast_Name[Sky]));
  494.      printf("%8s (%3d)  %8s  %8s", Temp_Name[Temp_Class], Temperature, Precip_Name[Precip_Class], Wind_Name[Wind]);
  495.      if (Snow_Depth > 0.0) 
  496.          printf(" %5.1f\" ", Snow_Depth);
  497.      else
  498.          printf("%8c", ' ');
  499.      print_notes(day, month);
  500.      printf("\n");
  501.  }
  502.  
  503. void
  504. init_winter()
  505.      /* initialize last year's winter */
  506. {
  507.      UBYTE day;
  508.      MONTH_T month;
  509.  
  510.      /* calculate snow depth for Oct. thru Dec. */
  511.      for (month = LAST_MONTH-2; month <= LAST_MONTH; month++)
  512.          for (day = 1; day <= Day_Table[month]; day++)
  513.          {
  514.              Catastrophe = FALSE;
  515.              if (DIE(100) > 50) 
  516.                  Weather = gen_weather(month, &Catastrophe);
  517.              Wind = gen_wind(month);
  518.              Temp_Class = gen_temp(month);
  519.              Precip_Class = gen_precip(month);
  520.              precip_statistics();
  521.              Sky = gen_overcast(Weather);
  522.          }
  523. }
  524.  
  525. init_stat()
  526. {
  527.     MONTH_T month;
  528.     STAT_T stat;
  529.  
  530.     for (month = FIRST_MONTH; month <= LAST_MONTH; month++)
  531.     {
  532.         Stat_Table[month][LOW] = 200;
  533.         for (stat = AVERAGE; stat <= HIGH; stat++)
  534.             Stat_Table[month][stat] = 0;
  535.     }
  536. }
  537.  
  538. main(argc, argv)  
  539. int argc;
  540. char *argv[];
  541. {
  542.      int cum_temp;               /* cumulative temp used for calculating average temp */
  543.      unsigned int sunshine = 0;  /* number of days of sunshine */
  544.      MONTH_T month;              /* month counter */
  545.      UBYTE day,                  /* day counter */
  546.            year,                 /* year counter */
  547.            n_years = 1;          /* number of years */
  548.  
  549.      srandom((int)time(0));
  550.      if (argc > 1)
  551.          n_years = atoi(argv[1]);
  552.      init_winter();
  553.      for (year = 1; year <= n_years; year++)
  554.      {
  555.          Rainfall = 0.0;
  556.          Snowfall = 0.0;
  557.          sunshine = 0;
  558.          init_stat();
  559.          printf("%64c%6s\n", ' ',"Snow");
  560.          printf("Year %3d%11s%11s%14s%10s%10s%7s%7s\n", year, "Weather", "Sky", "Temperature", "Precip", "Wind", "Depth", "Notes");
  561.          for (month = FIRST_MONTH; month <= LAST_MONTH; month++)
  562.          {
  563.              cum_temp = 0;
  564.              printf("%-9s\n", Month_Name[month]);
  565.              for (day = 1; day <= Day_Table[month]; day++)
  566.              {
  567.                  Catastrophe = FALSE;
  568.     
  569.                  /* half the time, Weather is the same as yesterday */
  570.                  if (DIE(100) > 50) 
  571.                      Weather = gen_weather(month, &Catastrophe);
  572.                  Wind = gen_wind(month);
  573.                  Temp_Class = gen_temp(month);
  574.                  cum_temp += Temperature;
  575.                  Precip_Class = gen_precip(month);
  576.                  precip_statistics();
  577.                  Sky = gen_overcast(Weather);
  578.     
  579.                  /* count sunny days */
  580.                  if (Weather == CLEAR) 
  581.                      sunshine++;
  582.                  print_weather(day, month);
  583.              }
  584.              Stat_Table[month][AVERAGE] = (cum_temp / Day_Table[month]);
  585.              printf("High Temp = %3d, Low Temp = %3d, Average Temp = %3d\n\n", Stat_Table[month][HIGH], Stat_Table[month][LOW], Stat_Table[month][AVERAGE]);
  586.          }
  587.          /* print yearly statistics */
  588.          printf("Sunshine = %3d days\n", sunshine);
  589.          printf("Rainfall = %4.1f\"\n", Rainfall);
  590.          printf("Snowfall = %4.1f\"\n\n", Snowfall);
  591.      }
  592. }
  593.  
  594. //E*O*F weather.c//
  595.  
  596. echo x - gregorian.h
  597. cat > "gregorian.h" << '//E*O*F gregorian.h//'
  598. /* Copyright 1988 by Brett D. Slocum - 12/12/88 */
  599. /* All rights reserved */
  600. /* This is the calendar include file is for weather generation */
  601. /* It includes calendar and holiday information */
  602.  
  603. /* To create a new calendar file, 
  604.        1) define month names for use by MONTH_T type,
  605.        2) define FIRST_MONTH and LAST_MONTH,
  606.        3) define string array Month_Name with printable version of month,
  607.        4) define number of days per month array Day_Table,
  608.        5) add printf statements in print_holidays for holidays
  609. */
  610.  
  611. /* Month types */
  612. #define JANUARY   0
  613. #define FEBRUARY  1
  614. #define MARCH     2
  615. #define APRIL     3
  616. #define MAY       4
  617. #define JUNE      5
  618. #define JULY      6
  619. #define AUGUST    7
  620. #define SEPTEMBER 8
  621. #define OCTOBER   9
  622. #define NOVEMBER  10
  623. #define DECEMBER  11
  624.  
  625. #define FIRST_MONTH JANUARY
  626. #define LAST_MONTH  DECEMBER
  627.  
  628. #define N_MONTHS (LAST_MONTH - FIRST_MONTH) + 1
  629.  
  630. char *Month_Name[N_MONTHS] = {
  631.     "January", 
  632.     "February",
  633.     "March",
  634.     "April",
  635.     "May",
  636.     "June",
  637.     "July",
  638.     "August",
  639.     "September",
  640.     "October",
  641.     "November",
  642.     "December"
  643. };
  644.  
  645. UBYTE Day_Table[N_MONTHS] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  646.  
  647. void
  648. print_holiday(day, month)
  649.     UBYTE day;
  650.     MONTH_T month;
  651. {
  652.      switch (month) {
  653.      case JANUARY : 
  654.          if (day == 1) 
  655.              printf(" New Years (s)");
  656.          if (day == 6) 
  657.              printf(" Twelfth Night");
  658.          break;
  659.      case FEBRUARY : 
  660.          if (day == 2) 
  661.              printf(" Candlemas");
  662.          if (day == 14) 
  663.              printf(" St. Valentine's Day");
  664.          break;
  665.      case MARCH : 
  666.          if (day == 21) 
  667.              printf(" Spring Equinox");
  668.          break;
  669.      case APRIL : 
  670.          break;
  671.      case MAY : 
  672.          if (day == 1) 
  673.              printf(" May Day");
  674.          break;
  675.      case JUNE : 
  676.          if (day == 21) 
  677.              printf(" Midsummer Day");
  678.          break;
  679.      case JULY : 
  680.          break;
  681.      case AUGUST : 
  682.          if (day == 2) 
  683.              printf(" Lammas");
  684.          break;
  685.      case SEPTEMBER : 
  686.          if (day == 21) 
  687.              printf(" Fall Equinox");
  688.          break;
  689.      case OCTOBER : 
  690.          if (day == 31) 
  691.              printf(" Halloween");
  692.          break;
  693.      case NOVEMBER : 
  694.          break;
  695.      case DECEMBER : 
  696.          if (day == 21) 
  697.              printf(" Winter Solstice");
  698.          if (day == 25) 
  699.              printf(" Christmas");
  700.          break;
  701.      }
  702. }
  703.  
  704. //E*O*F gregorian.h//
  705.  
  706. echo x - gulf.h
  707. cat > "gulf.h" << '//E*O*F gulf.h//'
  708. /* Most of the info provided in this file could be found in an almanac. */
  709.  
  710. /* Ave_Temp       - the average temperature for each month */
  711. /* Weather_Table  - each entry in the table is the weather profile for each month */
  712. /*                  for a random 1-100 die roll. */
  713. /*  month profile - {precipitation, overcast, taifun/hurricane, clear} */        
  714. /*        example - {30,35,0,100} means that in this month a roll of : */
  715. /*                  1-30  = precipitation        */
  716. /*                 31-35  = overcast             */
  717. /*                 no chance of taifun/hurricane */
  718. /*                 36-100 = clear                */
  719.  
  720. /* Wind_Table     - is structured like the Weather_Table. */
  721. /*  month profile - {Calm, Light, Brisk, Blustery, Gale}  */
  722.  
  723. /* Precip_Table   - as above */
  724. /*  month profile - {None, Sprinkle, Shower, Heavy, Steady} */
  725.  
  726. /* Overcast_Table - {Heavy Fog, Light Fog, Mist, Cloudy} */
  727.  
  728. UBYTE Ave_Temp[N_MONTHS] = {65, 70, 75, 80, 85, 95, 95, 90, 85, 75, 70, 65};
  729.  
  730. UBYTE Weather_Table[N_MONTHS][N_WEATHER] = {
  731.     {30,35,0,100}, {25,35,0,100}, {20,30,0,100}, {35,50,0,100}, {25,40,0,100}, {15,25,0,100}, 
  732.     {10,15,0,100}, {10,15,0,100}, {15,25,0,100}, {25,35,0,100}, {25,40,0,100}, {30,45,0,100}
  733. };
  734.  
  735. UBYTE Wind_Table[N_MONTHS][N_WIND] = {
  736.     {60,80,90,100,0}, {50,70,85,100,0}, {40,60,75,99,100}, {60,85,95,100,0}, {70,90,100,0,0}, {80,90,100,0,0}, 
  737.     {80,100,0,0,0}, {80,100,0,0,0}, {60,80,95,100,0}, {40,65,85,97,100}, {40,60,80,95,100}, {60,80,90,100,0}
  738. };
  739.  
  740. UBYTE Precip_Table[N_MONTHS][N_PRECIP] = {
  741.     {0,40,70,80,100},
  742.     {0,50,80,95,100},
  743.     {0,60,80,100,0},
  744.     {0,40,70,90,100},
  745.     {0,50,80,100,0},
  746.     {0,60,90,100,0},
  747.     {0,80,95,100,0},
  748.     {0,80,95,100,0},
  749.     {0,60,80,90,100},
  750.     {0,50,80,90,100},
  751.     {0,40,70,85,100},
  752.     {0,40,70,80,100}
  753. };
  754.  
  755. UBYTE Overcast_Table[N_OVERCAST] = {10,20,70,100};
  756.  
  757.  
  758. //E*O*F gulf.h//
  759.  
  760. echo x - japan.h
  761. cat > "japan.h" << '//E*O*F japan.h//'
  762. /* Copyright 1988 by Brett D. Slocum - 12/12/88 */
  763. /* All rights reserved */
  764. /* This is the calendar include file is for weather generation */
  765. /* It includes calendar and holiday information */
  766.  
  767. /* To create a new calendar file, 
  768.        1) define month names for use by MONTH_T type,
  769.        2) define FIRST_MONTH and LAST_MONTH,
  770.        3) define string array Month_Name with printable version of month,
  771.        4) define number of days per month array Day_Table,
  772.        5) add printf statements in print_holidays for holidays
  773. */
  774.  
  775. /* Month types */
  776. #define RAT    0
  777. #define BULL   1
  778. #define TIGER  2
  779. #define HARE   3
  780. #define DRAGON 4
  781. #define SNAKE  5
  782. #define HORSE  6
  783. #define SHEEP  7
  784. #define MONKEY 8
  785. #define BIRD   9
  786. #define DOG    10
  787. #define BOAR   11
  788.  
  789. #define FIRST_MONTH RAT
  790. #define LAST_MONTH  BOAR
  791.  
  792. #define N_MONTHS (LAST_MONTH - FIRST_MONTH) + 1
  793.  
  794. /* text version of month names */
  795. char *Month_Name[N_MONTHS] = {
  796.     "Rat",
  797.     "Bull",
  798.     "Tiger",
  799.     "Hare",
  800.     "Dragon",
  801.     "Snake",
  802.     "Horse",
  803.     "Sheep",
  804.     "Monkey",
  805.     "Bird",
  806.     "Dog",
  807.     "Boar"
  808. };
  809.  
  810. /* table of days per month */
  811. UBYTE Day_Table[N_MONTHS] = {29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30};
  812.  
  813. void
  814. print_holiday(day,month)
  815.     UBYTE day;
  816.     MONTH_T month;
  817.     /* prints holidays that fall on a given day */
  818. {
  819.      if (day == 15)
  820.          printf(" Full Moon,");
  821.      if (day == Day_Table[month])
  822.          printf(" New Moon,");
  823.      switch (day) { 
  824.      case 1:
  825.      case 15 : printf(" Shinto,");
  826.           break;
  827.      case 8:
  828.      case 18 : printf(" Buddhist,");
  829.           break;
  830.      case 28 : printf(" Buddhist, Shinto,");
  831.           break;
  832.      }
  833.      switch (month) {
  834.      case RAT : 
  835.          if ((day >= 1) AND (day <= 6))
  836.              printf(" New Years (s)");
  837.          break;
  838.      case BULL :
  839.          switch (day) { 
  840.          case 1: case 2: case 4: case 5: case 6: case 7:
  841.              printf(" Equinox (b)");
  842.              break;
  843.          case 3: 
  844.              printf(" Setsuban (1st Day of Spring) (s)");
  845.              break;
  846.          }
  847.          break;
  848.      case TIGER :
  849.          if (day == 3) 
  850.              printf(" Doll Festival (c)");
  851.          break;
  852.      case HARE :
  853.          if (day == 8)
  854.              printf(" Buddha's Birthday (b)");
  855.          break;
  856.      case DRAGON :
  857.          if (day == 5) 
  858.              printf(" Boy's Day (c)");
  859.          break;
  860.      case SNAKE :
  861.          switch (day) {
  862.          case 1: case 2: case 3: case 4: case 5: case 6: case 7: 
  863.              printf(" Rice Planting Festival (p)");
  864.              break;
  865.          case 30 : 
  866.              printf(" All debts paid (p)");
  867.          }
  868.          break;
  869.      case HORSE :
  870.          switch (day) {
  871.          case 1 : 
  872.              printf(" Midyear (p)");
  873.              break;
  874.          case 7 : 
  875.              printf(" Tanabata (Star Festival) (c)");
  876.              break;
  877.          case 13: case 14: case 15: 
  878.              printf(" Bon Festival (for the dead) (b)");
  879.          }
  880.          break;
  881.      case SHEEP :
  882.          if ((day >= 1) AND (day <= 7)) 
  883.              printf(" Equinox (b)");
  884.          break;
  885.      case BIRD :
  886.          switch (day) { 
  887.          case 15 : 
  888.               printf(" Rice Harvest Festival (p)");
  889.               break;
  890.          case 20 : 
  891.               printf(" Festival of Ebishu (s)");
  892.          } 
  893.          break;
  894.      case DOG :
  895.          if (day == 8) 
  896.              printf(" Feast of the Bellows (s)");
  897.          break;
  898.      case BOAR :
  899.          if (day == 30) 
  900.              printf(" All debts paid (p)");
  901.      }
  902. }
  903.  
  904. //E*O*F japan.h//
  905.  
  906. echo x - mid_atlantic.h
  907. cat > "mid_atlantic.h" << '//E*O*F mid_atlantic.h//'
  908. /* Most of the info provided in this file could be found in an almanac. */
  909.  
  910. /* Ave_Temp       - the average temperature for each month */
  911. /* Weather_Table  - each entry in the table is the weather profile for each month */
  912. /*                  for a random 1-100 die roll. */
  913. /*  month profile - {precipitation, overcast, taifun/hurricane, clear} */        
  914. /*        example - {30,35,0,100} means that in this month a roll of : */
  915. /*                  1-30  = precipitation        */
  916. /*                 31-35  = overcast             */
  917. /*                 no chance of taifun/hurricane */
  918. /*                 36-100 = clear                */
  919.  
  920. /* Wind_Table     - is structured like the Weather_Table. */
  921. /*  month profile - {Calm, Light, Brisk, Blustery, Gale}  */
  922.  
  923. /* Precip_Table   - as above */
  924. /*  month profile - {None, Sprinkle, Shower, Heavy, Steady} */
  925.  
  926. /* Overcast_Table - {Heavy Fog, Light Fog, Mist, Cloudy} */
  927.  
  928. UBYTE Ave_Temp[N_MONTHS] = {20, 35, 45, 55, 65, 75, 85, 80, 65, 50, 35, 25};
  929.  
  930. UBYTE Weather_Table[N_MONTHS][N_WEATHER] = {
  931.     {30,35,0,100}, {25,35,0,100}, {20,30,0,100}, {35,50,0,100}, {25,40,0,100}, {15,25,0,100}, 
  932.     {10,15,0,100}, {10,15,0,100}, {15,25,0,100}, {25,35,0,100}, {25,40,0,100}, {30,45,0,100}
  933. };
  934.  
  935. UBYTE Wind_Table[N_MONTHS][N_WIND] = {
  936.     {60,80,90,100,0}, {50,70,85,100,0}, {40,60,75,95,100}, {60,85,95,100,0}, {70,90,100,0,0}, {80,90,100,0,0}, 
  937.     {80,100,0,0,0}, {80,100,0,0,0}, {60,80,95,100,0}, {40,65,85,95,100}, {40,60,80,90,100}, {60,80,90,95,100}
  938. };
  939.  
  940. UBYTE Precip_Table[N_MONTHS][N_PRECIP] = {
  941.     {0,40,70,80,100},
  942.     {0,50,80,95,100},
  943.     {0,60,80,100,0},
  944.     {0,40,70,90,100},
  945.     {0,50,80,100,0},
  946.     {0,60,90,100,0},
  947.     {0,80,95,100,0},
  948.     {0,80,95,100,0},
  949.     {0,60,80,90,100},
  950.     {0,50,80,90,100},
  951.     {0,40,70,85,100},
  952.     {0,40,70,80,100}
  953. };
  954.  
  955. UBYTE Overcast_Table[N_OVERCAST] = {10,20,70,100};
  956.  
  957.  
  958. //E*O*F mid_atlantic.h//
  959.  
  960. echo x - middle_earth.h
  961. cat > "middle_earth.h" << '//E*O*F middle_earth.h//'
  962. /* Copyright 1988 by Brett D. Slocum - 12/12/88 */
  963. /* All rights reserved */
  964. /* This is the calendar include file is for weather generation */
  965. /* It includes calendar and holiday information */
  966.  
  967. /* To create a new calendar file, 
  968.        1) define month names for use by MONTH_T type,
  969.        2) define FIRST_MONTH and LAST_MONTH,
  970.        3) define string array Month_Name with printable version of month,
  971.        4) define number of days per month array Day_Table,
  972.        5) add printf statements in print_holidays for holidays
  973. */
  974.  
  975. /* Month types */
  976. #define AFTERYULE   0
  977. #define SOLMATH     1
  978. #define RETHE       2
  979. #define ASTRON      3
  980. #define THRIMIDGE   4
  981. #define FORELITHE   5
  982. #define AFTERLITHE  6
  983. #define WEDMATH     7
  984. #define HALIMATH    8
  985. #define WINTERFILTH 9
  986. #define BLOTMATH    10
  987. #define FOREYULE    11
  988.  
  989. #define FIRST_MONTH AFTERYULE
  990. #define LAST_MONTH  FOREYULE
  991.  
  992. #define N_MONTHS (LAST_MONTH - FIRST_MONTH) + 1
  993.  
  994. char *Month_Name[N_MONTHS] = {
  995.     "Afteryule",
  996.     "Solmath",
  997.     "Rethe",
  998.     "Astron",
  999.     "Thrimidge",
  1000.     "Forelithe",
  1001.     "Afterlithe",
  1002.     "Wedmath",
  1003.     "Halimath",
  1004.     "Winterfilth",
  1005.     "Blotmath",
  1006.     "Foreyule",
  1007. };
  1008.  
  1009. UBYTE Day_Table[N_MONTHS] = {30, 30, 30, 30, 30, 31, 30, 30, 30, 30, 30, 34};
  1010.  
  1011. void
  1012. print_holiday(day, month)
  1013.     UBYTE day;
  1014.     MONTH_T month;
  1015. {
  1016.      switch (month) {
  1017.      case AFTERYULE:
  1018.          break;
  1019.      case SOLMATH:
  1020.          break;
  1021.      case RETHE:
  1022.          break;
  1023.      case ASTRON:
  1024.          break;
  1025.      case THRIMIDGE:
  1026.          break;
  1027.      case FORELITHE:
  1028.          if (day == 31) 
  1029.              printf(" Midsummer Day");
  1030.          break;
  1031.      case AFTERLITHE:
  1032.          break;
  1033.      case WEDMATH:
  1034.          break;
  1035.      case HALIMATH:
  1036.          break;
  1037.      case WINTERFILTH:
  1038.          break;
  1039.      case BLOTMATH:
  1040.          break;
  1041.      case FOREYULE:
  1042.          if ((day >= 31) AND (day <= 34))
  1043.              printf(" Yule");
  1044.          break;
  1045.      }
  1046. }
  1047.  
  1048. //E*O*F middle_earth.h//
  1049.  
  1050. echo x - n_atlantic.h
  1051. cat > "n_atlantic.h" << '//E*O*F n_atlantic.h//'
  1052. /* Most of the info provided in this file could be found in an almanac. */
  1053.  
  1054. /* Ave_Temp       - the average temperature for each month */
  1055. /* Weather_Table  - each entry in the table is the weather profile for each month */
  1056. /*                  for a random 1-100 die roll. */
  1057. /*  month profile - {precipitation, overcast, taifun/hurricane, clear} */        
  1058. /*        example - {30,35,0,100} means that in this month a roll of : */
  1059. /*                  1-30  = precipitation        */
  1060. /*                 31-35  = overcast             */
  1061. /*                 no chance of taifun/hurricane */
  1062. /*                 36-100 = clear                */
  1063.  
  1064. /* Wind_Table     - is structured like the Weather_Table. */
  1065. /*  month profile - {Calm, Light, Brisk, Blustery, Gale}  */
  1066.  
  1067. /* Precip_Table   - as above */
  1068. /*  month profile - {None, Sprinkle, Shower, Heavy, Steady} */
  1069.  
  1070. /* Overcast_Table - {Heavy Fog, Light Fog, Mist, Cloudy} */
  1071.  
  1072. UBYTE Ave_Temp[N_MONTHS] = {10, 15, 25, 40, 55, 70, 85, 80, 60, 35, 20, 15};
  1073.  
  1074. UBYTE Weather_Table[N_MONTHS][N_WEATHER] = {
  1075.     {30,40,0,100}, /* January or the first month in non-Gregorian calendar */
  1076.     {25,35,0,100}, /* February */
  1077.     {20,30,0,100}, /* March */
  1078.     {35,50,0,100}, /* April */
  1079.     {25,40,0,100}, /* May */
  1080.     {15,25,0,100}, /* June */
  1081.     {10,15,0,100}, /* July */
  1082.     {10,15,0,100}, /* August */
  1083.     {15,30,0,100}, /* September */
  1084.     {25,40,0,100}, /* October */
  1085.     {25,40,0,100}, /* November */
  1086.     {30,45,0,100}  /* December */
  1087. };
  1088.  
  1089. UBYTE Wind_Table[N_MONTHS][N_WIND] = {
  1090.     {60,80,90,100,0},    /* January */
  1091.     {50,70,85,100,0},    /* February */  
  1092.     {40,60,75,95,100},   /* March */     
  1093.     {60,85,95,100,0},    /* April */     
  1094.     {70,90,100,0,0},     /* May */       
  1095.     {80,90,100,0,0},     /* June */      
  1096.     {80,100,0,0,0},      /* July */      
  1097.     {80,100,0,0,0},      /* August */    
  1098.     {60,80,95,100,0},    /* September */ 
  1099.     {40,65,85,95,100},   /* October */   
  1100.     {40,60,80,90,100},   /* November */  
  1101.     {60,80,90,95,100}    /* December */  
  1102. };
  1103.  
  1104. UBYTE Precip_Table[N_MONTHS][N_PRECIP] = {
  1105.     {0,40,70,80,100},   /* January */  
  1106.     {0,50,80,95,100},   /* February */ 
  1107.     {0,60,80,100,0},    /* March */    
  1108.     {0,40,70,90,100},   /* April */    
  1109.     {0,50,80,100,0},    /* May */      
  1110.     {0,60,90,100,0},    /* June */     
  1111.     {0,80,95,100,0},    /* July */     
  1112.     {0,80,95,100,0},    /* August */   
  1113.     {0,60,80,90,100},   /* September */
  1114.     {0,50,80,90,100},   /* October */  
  1115.     {0,40,70,85,100},   /* November */ 
  1116.     {0,40,70,80,100}    /* December */ 
  1117. };
  1118.  
  1119. UBYTE Overcast_Table[N_OVERCAST] = {10,20,70,100};
  1120.  
  1121.  
  1122. //E*O*F n_atlantic.h//
  1123.  
  1124. echo x - n_pacific.h
  1125. cat > "n_pacific.h" << '//E*O*F n_pacific.h//'
  1126. /* Most of the info provided in this file could be found in an almanac. */
  1127.  
  1128. /* Ave_Temp       - the average temperature for each month */
  1129. /* Weather_Table  - each entry in the table is the weather profile for each month */
  1130. /*                  for a random 1-100 die roll. */
  1131. /*  month profile - {precipitation, overcast, taifun/hurricane, clear} */        
  1132. /*        example - {30,35,0,100} means that in this month a roll of : */
  1133. /*                  1-30  = precipitation        */
  1134. /*                 31-35  = overcast             */
  1135. /*                 no chance of taifun/hurricane */
  1136. /*                 36-100 = clear                */
  1137.  
  1138. /* Wind_Table     - is structured like the Weather_Table. */
  1139. /*  month profile - {Calm, Light, Brisk, Blustery, Gale}  */
  1140.  
  1141. /* Precip_Table   - as above */
  1142. /*  month profile - {None, Sprinkle, Shower, Heavy, Steady} */
  1143.  
  1144. /* Overcast_Table - {Heavy Fog, Light Fog, Mist, Cloudy} */
  1145.  
  1146. UBYTE Ave_Temp[N_MONTHS] = {40, 50, 60, 65, 70, 80, 85, 75, 65, 50, 40, 35};
  1147.  
  1148. UBYTE Weather_Table[N_MONTHS][N_WEATHER] = {
  1149.     {10,15,0,100}, {35,45,0,100}, {50,70,0,100}, {50,70,0,100}, {50,60,0,100}, {50,60,0,100}, 
  1150.     {35,40,0,100}, {40,45,55,100}, {40,45,55,100}, {10,15,17,100}, {10,15,0,100}, {10,15,0,100}
  1151. };
  1152.  
  1153. UBYTE Wind_Table[N_MONTHS][N_WIND] = {
  1154.     {40,70,90,100,0}, {40,70,90,100,0}, {40,70,90,100,0}, {40,70,90,100,0}, {40,70,90,100,0}, {40,70,90,100,0}, 
  1155.     {40,70,90,100,0}, {40,70,90,100,0}, {40,70,90,100,0}, {40,70,90,100,0}, {40,70,90,100,0}, {40,70,90,100,0}
  1156. };
  1157.  
  1158. UBYTE Precip_Table[N_MONTHS][N_PRECIP] = {
  1159.     {0,40,70,80,100},
  1160.     {0,50,80,95,100},
  1161.     {0,60,80,100,0},
  1162.     {0,40,70,90,100},
  1163.     {0,50,80,100,0},
  1164.     {0,60,90,100,0},
  1165.     {0,80,95,100,0},
  1166.     {0,80,95,100,0},
  1167.     {0,60,80,90,100},
  1168.     {0,50,80,90,100},
  1169.     {0,40,70,85,100},
  1170.     {0,40,70,80,100}
  1171. };
  1172.  
  1173. UBYTE Overcast_Table[N_OVERCAST] = {10,20,70,100};
  1174.  
  1175.  
  1176. //E*O*F n_pacific.h//
  1177.  
  1178. echo x - s_atlantic.h
  1179. cat > "s_atlantic.h" << '//E*O*F s_atlantic.h//'
  1180. /* Most of the info provided in this file could be found in an almanac. */
  1181.  
  1182. /* Ave_Temp       - the average temperature for each month */
  1183. /* Weather_Table  - each entry in the table is the weather profile for each month */
  1184. /*                  for a random 1-100 die roll. */
  1185. /*  month profile - {precipitation, overcast, taifun/hurricane, clear} */        
  1186. /*        example - {30,35,0,100} means that in this month a roll of : */
  1187. /*                  1-30  = precipitation        */
  1188. /*                 31-35  = overcast             */
  1189. /*                 no chance of taifun/hurricane */
  1190. /*                 36-100 = clear                */
  1191.  
  1192. /* Wind_Table     - is structured like the Weather_Table. */
  1193. /*  month profile - {Calm, Light, Brisk, Blustery, Gale}  */
  1194.  
  1195. /* Precip_Table   - as above */
  1196. /*  month profile - {None, Sprinkle, Shower, Heavy, Steady} */
  1197.  
  1198. /* Overcast_Table - {Heavy Fog, Light Fog, Mist, Cloudy} */
  1199.  
  1200. UBYTE Ave_Temp[N_MONTHS] = {50, 60, 65, 70, 75, 80, 85, 80, 75, 65, 55, 50};
  1201.  
  1202. UBYTE Weather_Table[N_MONTHS][N_WEATHER] = {
  1203.     {30,35,0,100}, {25,35,0,100}, {20,30,0,100}, {35,50,0,100}, {25,40,0,100}, {15,25,0,100}, 
  1204.     {10,15,0,100}, {10,15,0,100}, {15,25,0,100}, {25,35,0,100}, {25,40,0,100}, {30,45,0,100}
  1205. };
  1206.  
  1207. UBYTE Wind_Table[N_MONTHS][N_WIND] = {
  1208.     {60,80,90,100,0}, {50,70,85,100,0}, {40,60,75,99,100}, {60,85,95,100,0}, {70,90,100,0,0}, {80,90,100,0,0}, 
  1209.     {80,100,0,0,0}, {80,100,0,0,0}, {60,80,95,100,0}, {40,65,85,97,100}, {40,60,80,95,100}, {60,80,90,100,0}
  1210. };
  1211.  
  1212. UBYTE Precip_Table[N_MONTHS][N_PRECIP] = {
  1213.     {0,40,70,80,100},
  1214.     {0,50,80,95,100},
  1215.     {0,60,80,100,0},
  1216.     {0,40,70,90,100},
  1217.     {0,50,80,100,0},
  1218.     {0,60,90,100,0},
  1219.     {0,80,95,100,0},
  1220.     {0,80,95,100,0},
  1221.     {0,60,80,90,100},
  1222.     {0,50,80,90,100},
  1223.     {0,40,70,85,100},
  1224.     {0,40,70,80,100}
  1225. };
  1226.  
  1227. UBYTE Overcast_Table[N_OVERCAST] = {10,20,70,100};
  1228.  
  1229.  
  1230. //E*O*F s_atlantic.h//
  1231.  
  1232. echo x - weather.h
  1233. cat > "weather.h" << '//E*O*F weather.h//'
  1234. #ifdef SYSV
  1235. #define srandom srand48
  1236. #define random lrand48
  1237. #endif
  1238.  
  1239. #define DIE(n) ((int)(random() % (unsigned)n)+1)
  1240. #define MIN(a,b) ((a<b) ? a : b)
  1241. #define MAX(a,b) ((a>b) ? a : b)
  1242.  
  1243. #define AND &&
  1244. #define OR  ||
  1245.  
  1246. typedef unsigned char UBYTE;
  1247. typedef UBYTE BOOL;
  1248.  
  1249. typedef short STAT_T;
  1250. typedef short WEATHER_T;
  1251. typedef short OVERCAST_T;
  1252. typedef short WIND_T;
  1253. typedef short TEMP_T;
  1254. typedef short PRECIP_T;
  1255.  
  1256. /* Boolean types */
  1257. #define FALSE 0
  1258. #define TRUE  1
  1259.  
  1260. /* Statistics types */
  1261. #define N_STAT  3
  1262. #define LOW     0
  1263. #define AVERAGE 1
  1264. #define HIGH    2
  1265.  
  1266. /* Weather types */
  1267. #define N_WEATHER     4
  1268. #define PRECIPITATION 0
  1269. #define OVERCAST      1
  1270. #define TAIFUN        2
  1271. #define CLEAR         3
  1272.  
  1273. char *Weather_Name[N_WEATHER] = {
  1274.     "Precipitation",
  1275.     "Overcast",
  1276.     "Typhoon",
  1277.     "Clear"
  1278. };
  1279.  
  1280. /* Overcast types */
  1281. #define N_OVERCAST 4
  1282. #define HEAVY_FOG  0
  1283. #define LIGHT_FOG  1
  1284. #define MIST       2
  1285. #define CLOUDY     3
  1286.  
  1287. char *Overcast_Name[N_OVERCAST] = {
  1288.     "Heavy Fog",
  1289.     "Light Fog",
  1290.     "Mist",
  1291.     "Cloudy",
  1292. };
  1293.  
  1294. /* Wind types */
  1295. #define N_WIND   5
  1296. #define CALM     0
  1297. #define LIGHT    1
  1298. #define BRISK    2
  1299. #define BLUSTERY 3
  1300. #define GALE     4
  1301.  
  1302. char *Wind_Name[N_WIND] = {
  1303.     "Calm",
  1304.     "Light",
  1305.     "Brisk",
  1306.     "Blustery",
  1307.     "Gale",
  1308. };
  1309.  
  1310. /* Temperature types */
  1311. #define N_TEMP 5
  1312. #define COLD   0
  1313. #define CHILLY 1
  1314. #define FAIR   2
  1315. #define WARM   3
  1316. #define HOT    4
  1317.  
  1318. char *Temp_Name[N_TEMP] = {
  1319.     "Cold",
  1320.     "Chilly",
  1321.     "Fair",
  1322.     "Warm",
  1323.     "Hot",
  1324. };
  1325.  
  1326. /* Precipitation types */
  1327. #define N_PRECIP 5
  1328. #define NONE     0
  1329. #define SPRINKLE 1
  1330. #define SHOWER   2
  1331. #define HEAVY    3
  1332. #define STEADY   4
  1333.  
  1334. char *Precip_Name[N_PRECIP] = {
  1335.     "None",
  1336.     "Sprinkle",
  1337.     "Shower",
  1338.     "Heavy",
  1339.     "Steady",
  1340. };
  1341.  
  1342. UBYTE Temp_Variation[9] = {1, 5, 13, 25, 75, 87, 95, 99, 100};
  1343. //E*O*F weather.h//
  1344.  
  1345. exit 0
  1346.  
  1347.  
  1348.