1 /*
2  * E M P I R E
3  *
4  * (C) CLOAD 1981
5  * PETER TREFONAS 12/30/1979
6  *
7  * Credits:
8  *   "Hammurabi" BY RICK MERRIL & DAVID AHL
9  *   "Santa Paravia" BY GEORGE BLANK
10  *
11  * Original version written in Basic for the TRS-80
12  * http://willus.com/trs80/?-a+1+-p+125903+-f+4
13  *
14  * Conversion to C by aralbrec@z88dk.org July 2016
15  * (instructions excluded from some builds due to size)
16  *
17  * zcc +cpm -vn -SO3 -clib=sdcc_iy --max-allocs-per-node200000 --opt-code-size empire.c -o empire -lm -create-app -DINSTR
18  * zcc +zx -vn -SO3 -startup=4 -clib=sdcc_iy --max-allocs-per-node200000 --opt-code-size empire.c -o empire -lm -create-app -DINSTR
19  *
20  */
21 
22 #pragma printf = "%s %d %f"
23 #pragma scanf  = "%s %d %["
24 
25 #pragma output CLIB_EXIT_STACK_SIZE  = 0
26 #pragma output CLIB_MALLOC_HEAP_SIZE = 128
27 #pragma output CLIB_STDIO_HEAP_SIZE  = 0
28 
29 #ifdef __SPECTRUM
30 
31 #pragma output CRT_ORG_CODE          = 24000
32 #pragma output REGISTER_SP           = -1
33 #pragma output CRT_ENABLE_EIDI       = 0x21
34 
35 #include <stropts.h>
36 
37 #endif
38 
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <string.h>
42 #include <stdarg.h>
43 #include <ctype.h>
44 #include <math.h>
45 #include <input.h>
46 
47 char *Z[7][7] = {
48    {0, 0, 0, 0, 0, 0, 0},
49    {"Montaigne", "Auveyron", "Chevalier", "Prince", "Roi", "Empereur", "francs"},
50    {"Arthur", "Brittany", "Sir", "Prince", "King", "Emperor", "francs"},
51    {"Munster", "Bavaria", "Ritter", "Prinz", "Konig", "Kaiser", "marks"},
52    {"Khotan", "Quatara", "Hasid", "Caliph", "Sheik", "Shah", "dinars"},
53    {"Ferdinand", "Barcelona", "Caballero", "Principe", "Rey", "Emperadore", "peseta"},
54    {"Hjodolf", "Svealand", "Riddare", "Prins", "Kung", "Kejsare", "krona"}
55 };
56 
57 double_t A[7][20] = {
58    { 0, 10000, 15000, 2000, 1000, 0, 0, 25, 20, 5, 35, 0, 0, 0, 0, 20, 0, 2, 1, 15 },
59    { 0, 10000, 15000, 2000, 1000, 0, 0, 25, 20, 5, 35, 0, 0, 0, 0, 20, 0, 2, 1, 15 },
60    { 0, 10000, 15000, 2000, 1000, 0, 0, 25, 20, 5, 35, 0, 0, 0, 0, 20, 0, 2, 1, 15 },
61    { 0, 10000, 15000, 2000, 1000, 0, 0, 25, 20, 5, 35, 0, 0, 0, 0, 20, 0, 2, 1, 15 },
62    { 0, 10000, 15000, 2000, 1000, 0, 0, 25, 20, 5, 35, 0, 0, 0, 0, 20, 0, 2, 1, 15 },
63    { 0, 10000, 15000, 2000, 1000, 0, 0, 25, 20, 5, 35, 0, 0, 0, 0, 20, 0, 2, 1, 15 },
64    { 0, 10000, 15000, 2000, 1000, 0, 0, 25, 20, 5, 35, 0, 0, 0, 0, 20, 0, 2, 1, 15 }
65 };
66 
67 char buf[64];  // input buffer
68 
69 double_t BA = 6000.0;   // barbarian land holdings
70 
71 int FLAG;      // dummy variable
72 
73 double_t D;    // dummy variable
74 int E;         // dummy variable
75 double_t E1;   // dummy variable
76 double_t E2;   // dummy variable
77 int H;         // dummy variable
78 int H1;        // dummy variable
79 double_t H2;   // dummy variable
80 double_t H3;   // dummy variable
81 int I;         // index, dummy variable
82 double_t I0;
83 double_t I1;   // dummy variable
84 double_t I2;   // dummy variable
85 double_t I3;
86 double_t I4;
87 double_t I5;
88 double_t I6;
89 double_t I7;
90 int IH;
91 int J;         // index, dummy variable
92 double_t IF;   // dummy variable
93 int O;
94 double_t O1;
95 
96 int KK;        // game over flag
97 int KL;        // dummy flag
98 int K;         // current player
99 int NP;        // number of human players
100 int NY;        // current year
101 int NW;        // weather
102 
103 int IQ;        // number of attacks in round
104 
105 double_t LA;   // dummy variable
106 double_t HM;   // grain fed to army
107 double_t HS;   // grain fed to population
108 double_t PO;   // non-military population
109 
110 double_t DB;   // number of births
111 double_t DD;   // deaths due to disease
112 double_t DS;   // deaths due to starvation
113 double_t DE;   // number of immigrants
114 double_t DM;   // deaths due to malnutrition
115 double_t DA;   // army deaths due to starvation
116 double_t PA;   // army desertion?
117 double_t PT;   // net population change
118 
119 double_t PD;   // grain required by people
120 double_t AD;   // grain required by army
121 double_t HA;   // grain harvested
122 double_t RA;   // percentage of grain eaten by rats
123 
124 double_t FC;   // customs tax revenue
125 double_t FS;   // sales tax revenue
126 double_t FI;   // income tax revenue
127 
128 double_t F1;   // marketplace profit
129 double_t F2;   // grain mill profit
130 double_t F3;   // foundry profit
131 double_t F4;   // shipyard profit
132 double_t F5;   // soldier profit (cost)
133 
134 int Q;
135 int QF;        // computer playing flag
136 int QP;        // count of active players
137 double_t Q0;   // average totals of active players
138 double_t Q2;   // average totals of active players
139 double_t Q3;   // average totals of active players
140 double_t Q4;   // average totals of active players
141 double_t Q5;   // average totals of active players
142 double_t Q6;   // average totals of active players
143 double_t Q7;   // average totals of active players
144 double_t Q8;   // average totals of active players
145 double_t Q9;   // average totals of active players
146 double_t QB;   // average totals of active players
147 double_t QC;   // average totals of active players
148 double_t QD;   // average totals of active players
149 double_t QR;
150 
151 
CLS(void)152 void CLS(void)
153 {
154 #ifdef __SPECTRUM
155    ioctl(1, IOCTL_OTERM_CLS);
156 #else
157    puts("\n\n\n");
158 #endif
159 }
160 
RND0(void)161 double_t RND0(void)
162 {
163    return rand()/(double_t)((unsigned int)RAND_MAX+1);
164 }
165 
RND(double_t n)166 double_t RND(double_t n)
167 {
168    return (n == 0.0) ? RND0() : RND0()*n+1.0;
169 }
170 
FRND(double_t n)171 double_t FRND(double_t n)
172 {
173    return floor(RND(n));
174 }
175 
PAUSE(unsigned int p)176 void PAUSE(unsigned int p)
177 {
178    in_wait_nokey();
179    in_pause(p);
180    in_wait_nokey();
181 }
182 
INPUT(char * p,char * fmt,...)183 void INPUT(char *p, char *fmt, ...)
184 {
185    va_list arg;
186    va_start(arg, fmt);
187 
188    printf("%s", p);
189    in_wait_nokey();
190 
191    fflush(stdin);
192    vscanf(fmt, arg);
193 }
194 
player_promotion(void)195 void player_promotion(void)
196 {
197    // Line 359
198 
199    if ((int)A[K][0] != 0) return;
200 
201    if ((A[K][11] > 7.0) && (A[K][12] > 3.0) && (A[K][16] > 1.0) && (A[K][1]/A[K][3] > 4.8) && (A[K][3] > 2300.0) && (A[K][18] > 10.0))
202       A[K][17] = 3.0;
203 
204    if ((A[K][11] > 13.0) && (A[K][12] > 5.0) && (A[K][13] > 0.0) && (A[K][16] > 5.0) && (A[K][1]/A[K][3] > 5.0) && (A[K][3] > 2600.0) && (A[K][18] > 25.0))
205       A[K][17] = 4.0;
206 
207    if ((A[K][17] > 3.0) && (A[K][16] > 9.0) && (A[K][4] > 3100.0) && (A[K][18] > 40.0))
208    {
209       CLS();
210 
211       puts("Game over . . .");
212       printf("%s %s of %s Wins !\n\n", Z[K][5], Z[K][0], Z[K][1]);
213 
214       A[K][17] = 5.0;
215       KK = 1;
216    }
217 }
218 
219 char *udeath[] = {
220    "has been assassinated by an ambitious\nnoble.\n",
221    "has been killed from a fall during\nthe annual fox-hunt.\n",
222    "died of acute food poisoning.\nThe royal cook was summarily executed.\n",
223    "passed away this winter from a weak heart.\n"
224 };
225 
unfortunate_death(int flag)226 void unfortunate_death(int flag)
227 {
228    CLS();
229 
230    puts("Very sad news ...\n");
231    printf("%s %s ", Z[K][(int)A[K][17]], Z[K][0]);
232 
233    if (flag)
234       printf("of %s has been assassinated\nby a crazed mother whose child had starved to death . . .\n\n", Z[K][1]);
235    else
236       puts(udeath[(int)RND(4.0)-1]);
237 
238    puts("The other nation-states have sent representatives to the\nfuneral.\n");
239    PAUSE(10000);
240 
241    A[K][0] = 1.0;
242 }
243 
print_battle_report(void)244 void print_battle_report(void)
245 {
246    CLS();
247 
248    printf("Land holdings:\n\n%-16s%10.0f\n", "1)  Barbarians", BA);
249    for (I=1; I<=6; ++I)
250       if ((int)A[I][0] == 0) printf("%d)  %-12s%10.0f\n", I+1, Z[I][1], A[I][1]);
251 }
252 
exit_qf(int flag)253 void exit_qf(int flag)
254 {
255    if (flag == 1)
256       PAUSE(15000);
257    else
258    {
259       puts("<Enter>");
260       PAUSE(30000);
261    }
262 }
263 
battle(void)264 void battle(void)
265 {
266    // Line 279
267 
268    CLS();
269    printf("%41s\n\n", "Soldiers Remaining");
270 
271    snprintf(buf, sizeof(buf), "%s %s of %s", Z[K][(int)A[K][17]], Z[K][0], Z[K][1]);
272    printf("%*s\n%33s\n", (64+strlen(buf))/2, buf, "VS");
273 
274    I4 = A[K][19];
275    I5 = 0.0;
276    I2 = A[I][15];
277    I0 = A[I][1];
278    O1 = 75.0 - I1 - I2;
279 
280    A[K][15] -= I1;
281 
282    if (I == 0)
283    {
284       printf("%40s\n\n", "Pagan barbarians");
285 
286       I2 = RND(RND(I1)*3) + RND(RND(I1*1.5));
287       I3 = 9.0;
288       I0 = BA;
289       O1 = 75.0 - I1 - I2;
290    }
291    else
292    {
293       snprintf(buf, sizeof(buf), "%s %s of %s", Z[I][(int)A[I][17]], Z[I][0], Z[I][1]);
294       printf("%*s\n", (64+strlen(buf))/2, buf);
295 
296       I3 = A[I][19];
297       IH = 0;
298 
299       if (A[I][15] < 1.0)
300       {
301          snprintf(buf, sizeof(buf), "%s's serfs are forced to defend their country!", Z[I][1]);
302          printf("%*s\n", (64+strlen(buf))/2, buf);
303 
304          I2 = A[I][3];
305          I3 = 5.0;
306          IH = 1;
307          O1 = -1.0;
308       }
309 
310       puts("");
311    }
312 
313    // Line 287
314 
315    FLAG = 0;
316    do
317    {
318       snprintf(buf, sizeof(buf), "%10.0f  :  %-10.0f", I1, I2);
319       printf("%*s\n", (64+strlen(buf))/2, buf);
320 
321       if (O1 > 0.0) PAUSE(O1);
322 
323       I7 = floor(I1/15.0+1.0);
324 
325       if (RND(I4) >= RND(I3))
326       {
327          I5 += RND(I7*26.0) - RND(I7+5.0);
328          I2 -= I7;
329          if (I5 < 0.0) I5 = 0.0;
330       }
331       else
332       {
333          I1 -= I7;
334          if (I0 < I5) FLAG = 1;
335       }
336    }
337    while ((I1 > 0.0) && (I2 > 0.0) && !FLAG);
338 
339    if (I1 < 0.0) I1 = 0.0;
340    if (I2 < 0.0) I2 = 0.0;
341 
342    printf("\n%37s", "Battle over");
343    PAUSE(5000);
344 
345    CLS();
346    puts("Battle over\n");
347 
348    if (FLAG || ((IH == 1) && (I1 > 0.0)))
349    {
350       // Line 341
351 
352       if (I == 0)
353       {
354          puts("All barbarian lands have been seized.\nThe remaining barbarians fled.\n");
355 
356          A[K][1]  += I5;
357          A[K][15] += I1;
358 
359          BA = 0.0;
360       }
361       else
362       {
363          printf("The country of %s was over-run!\nAll enemy nobles were summarily executed!\n\n", Z[I][1]);
364 
365          puts("The remaining enemy soldiers were imprisoned. All enemy serfs\n"
366               "have pledged oaths of fealty to you, and should now be consid-\n"
367               "ered to be your people too. All enemy merchants fled the coun-\n"
368               "try. Unfortuntately, all enemy assets were sacked and destroyed\n"
369               "by your vengeful army in a drunken riot following the victory\n"
370               "celebration.\n");
371 
372          if (IH == 1)
373          {
374             IH = 0;
375             A[I][3] = I2;
376          }
377 
378          A[K][15] += I1;
379          A[K][1]  += A[I][1];
380          A[I][1]   = 0.0;
381          A[I][0]   = 1.0;
382          A[K][3]  += A[I][3];
383       }
384 
385       exit_qf(QF);
386       return;
387    }
388    else
389    {
390       // Line 307
391 
392       if (I1 > 0.0)
393       {
394          printf("The forces of %s %s were victorious.\n", Z[K][(int)A[K][17]], Z[K][0]);
395          printf("%.0f acres were seized.\n\n", I5);
396       }
397       else
398       {
399          printf("%s %s was defeated.\n", Z[K][(int)A[K][17]], Z[K][0]);
400 
401          if (I5 < 2.0)
402          {
403             I5 = 0.0;
404             puts("0 acres were seized.\n\n");
405          }
406          else
407          {
408             I5 = floor(I5/RND(3.0));
409             printf("In your defeat you nevertheless managed to capture %.0f acres.\n\n", I5);
410          }
411       }
412 
413       // Line 317
414 
415       if ((I != 0) && (I5 > A[I][1]/3.0))
416       {
417          // Line 325
418 
419          if (A[I][3] > 1.0)
420          {
421             I6 = FRND(A[I][3]);
422             printf("%.0f enemy serfs were beaten and murdered by your troops!\n", I6);
423             A[I][3] -= I6;
424          }
425 
426          if (A[I][11] > 1.0)
427          {
428             I6 = FRND(A[I][11]);
429             printf("%.0f enemy marketplaces were destroyed\n", I6);
430             A[I][11] -= I6;
431          }
432 
433          if (A[I][2] > 1.0)
434          {
435             I6 = FRND(A[I][2]);
436             printf("%.0f bushels of enemy grain were burned\n", I6);
437             A[I][2] -= I6;
438          }
439 
440          if (A[I][12] > 1.0)
441          {
442             I6 = FRND(A[I][12]);
443             printf("%.0f enemy grain mills were sabotaged\n", I6);
444             A[I][12] -= I6;
445          }
446 
447          if (A[I][13] > 1.0)
448          {
449             I6 = FRND(A[I][13]);
450             printf("%.0f enemy foundries were levelled\n", I6);
451             A[I][13] -= I6;
452          }
453 
454          if (A[I][14] > 1.0)
455          {
456             I6 = FRND(A[I][14]);
457             printf("%.0f enemy shipyards were over-run\n", I6);
458             A[I][14] -= I6;
459          }
460 
461          if (A[I][18] > 3.0)
462          {
463             I6 = FRND(A[I][18]/2.0);
464             printf("%.0f enemy nobles were summarily executed\n", I6);
465             A[I][18] -= I6;
466          }
467 
468          puts("");
469 
470          A[K][1] += I5;
471          A[I][1] -= I5;
472 
473          exit_qf(QF);
474          return;
475       }
476 
477       // Line 319
478 
479       A[K][15] += I1;
480       A[K][1]  += I5;
481 
482       if (I == 0)
483       {
484          BA -= I5;
485          exit_qf(QF);
486          return;
487       }
488 
489       // Line 321
490 
491       if (IH == 1)
492       {
493          IH = 0;
494 
495          A[I][15] = 0.0;
496          A[I][3]  = I2;
497          A[I][1] -= I5;
498 
499          exit_qf(QF);
500          return;
501       }
502 
503       A[I][15]  = I2;
504       A[I][1]  -= I5;
505 
506       exit_qf(QF);
507       return;
508    }
509 }
510 
print_revenue_report(void)511 void print_revenue_report(void)
512 {
513    CLS();
514 
515    printf("State Revenues\nTreasury = %.2f %s\n\n", A[K][4], Z[K][6]);
516    puts("Customs duty    Sales tax       Income tax");
517    printf("%11.0f%%%12.0f%%%16.0f%%\n", A[K][8], A[K][9], A[K][10]);
518    printf("%11.0f %12.0f %16.0f\n\n", FC, FS, FI);
519 
520    printf("%-16s%10s%14s%8s\n\n", "Investments", "Number", "Profits", "Cost");
521    printf("%-16s%10.0f%14.0f%8s\n", "1) Marketplaces", A[K][11], F1, "1000");
522    printf("%-16s%10.0f%14.0f%8s\n", "2) Grain mills", A[K][12], F2, "2000");
523    printf("%-16s%10.0f%14.0f%8s\n", "3) Foundries", A[K][13], F3, "7000");
524    printf("%-16s%10.0f%14.0f%8s\n", "4) Shipyards", A[K][14], F4, "8000");
525    printf("%-16s%10.0f%14.0f%8s\n", "5) Soldiers", A[K][15], F5, "8");
526    printf("%-16s%10.0f%-14s%8s\n", "6) Palace", A[K][16]*10.0, "% Completed", "5000");
527 
528    if (KL == 1) KL = 0;
529 }
530 
print_grain_report(void)531 void print_grain_report(void)
532 {
533    CLS();
534 
535    printf("%s %s of %s\n", Z[K][(int)A[K][17]], Z[K][0], Z[K][1]);
536    printf("Land Holdings %.1f\n\n", A[K][1]);
537    printf("Rats ate %.0f%% of the grain reserve\n\n", RA);
538    puts("Grain      Grain     People     Army       Royal");
539    puts("harvest   reserve   require    requires   treasury");
540    printf("%7.0f%10.0f%10.0f%11.0f%11.0f\n", HA, A[K][2], PD, AD, A[K][4]);
541    printf("bushels   bushels   bushels    bushels    %s\n", Z[K][6]);
542 
543    // Line 93
544 
545    puts("\n------Grain for sale:\n");
546    printf("  Country%10sBushels%4sPrice\n", "", "", "");
547 
548    J = 0;
549    for (I=1; I<=6; ++I)
550    {
551       if (((int)A[I][0] == 0) && (A[I][5] != 0.0))
552       {
553          J = 1;
554          printf("%-2d%-13s%11.0f%9.2f\n", I, Z[I][1], A[I][5], A[I][6]);
555       }
556    }
557 
558    if (J == 0) puts("\n\nNo grain for sale . . .");
559 }
560 
action_grain_report(void)561 void action_grain_report(void)
562 {
563    if (H == 1)
564    {
565        // Line 105
566 
567       do { INPUT("From which country (give #)? ", "%d", &H1); } while ((H1 < 0) || (H1 > 6));
568       if (H1 == 0) return;
569 
570       if (((int)A[H1][0] == 1) || (A[H1][5] == 0.0))
571       {
572          puts("That country has none for sale!");
573          PAUSE(3000);
574          return;
575       }
576 
577       if (H1 == K)
578       {
579          puts("You cannot buy grain that you have put on the market!");
580          PAUSE(3000);
581          return;
582       }
583 
584       do
585       {
586          do
587          {
588             INPUT("How many bushels? ", "%30[0-9.-]", buf);
589             H2 = atof(buf);
590 
591             FLAG = H2 > A[H1][5];
592 
593             if (FLAG)
594             {
595                puts("You can't buy more grain than they are selling!\n");
596                PAUSE(3000);
597             }
598          }
599          while (FLAG || (H2 < 0.0));
600 
601          H3 = H2 * A[H1][6] / 0.9;
602 
603          FLAG = H3 > A[K][4];
604 
605          if (FLAG)
606             printf("%s %s please reconsider -\nYou can only afford to buy %.1f bushels.\n", Z[K][(int)A[K][17]], Z[K][0], A[K][4]*0.9/A[H1][6]);
607       }
608       while (FLAG);
609 
610       A[K][2] += H2;
611       A[K][4] -= H3;
612 
613       A[H1][4] += H3 * 0.9;
614       A[H1][5] -= H2;
615    }
616    else if (H == 2)
617    {
618       // Line 121
619 
620       do
621       {
622          INPUT("How many bushels do you wish to sell? ", "%30[0-9.-]s", buf);
623          H2 = atof(buf);
624 
625          FLAG = H2 > A[K][2];
626 
627          if (FLAG)
628          {
629             printf("%s %s, please think again\nYou only have %.0f bushels.\n", Z[K][(int)A[K][17]], Z[K,0], A[K][2]);
630             PAUSE(3000);
631          }
632       }
633       while (FLAG || (H2 < 0.0));
634 
635       if (H2 != 0.0)
636       {
637          do
638          {
639             INPUT("What will be the price per bushel? ", "%30[0-9.-]", buf);
640             H3 = atof(buf);
641 
642             FLAG = H3 > 15.0;
643 
644             if (FLAG)
645                puts("Be reasonable . . .even gold costs less than that!\n");
646          }
647          while (FLAG || (H3 <= 0.0));
648 
649          A[K][6] = (A[K][6]*A[K][5] + H2*H3) / (A[K][5]+H2);
650 
651          A[K][5] += H2;
652          A[K][2] -= H2;
653       }
654    }
655    else if (H == 3)
656    {
657       // Line 133
658 
659       do
660       {
661          printf("The barbarians will give you two %s per acre\n", Z[K][6]);
662 
663          INPUT("How many acres will you sell them? ", "%30[0-9.-]", buf);
664          H2 = atof(buf);
665 
666          FLAG = H2 > A[K][1]*0.95;
667 
668          if (FLAG)
669             puts("You must keep some land for the royal palace!");
670       }
671       while (FLAG || (H2 < 0.0));
672 
673       A[K][4] += H2*2.0;
674       A[K][1] -= H2;
675 
676       BA += H2;
677    }
678 }
679 
680 struct {
681    char *s;
682    int   max;
683 }
684 tax_query[] = {
685    { "Give new customs tax (max=50%)? ", 50 },
686    { "Give new sales tax (max=20%)? ", 20 },
687    { "Give new income tax (max=35%)? ", 35 }
688 };
689 
player_human(void)690 void player_human(void)
691 {
692    // Line 65
693    // Line 395
694 
695    if (RND0() <= 0.02)
696    {
697       CLS();
698 
699       puts("P L A G U E  ! ! !");
700       puts("Black death has struck your nation.\n");
701 
702       IF = FRND(A[K][3]/2.0);
703       A[K][3] -= IF;
704       printf("%.0f serfs died.\n", IF);
705 
706       IF = FRND(A[K][7]/3.0);
707       A[K][7] -= IF;
708       printf("%.0f merchants died.\n", IF);
709 
710       IF = FRND(A[K][15]/3.0);
711       A[K][15] -= IF;
712       printf("%.0f soldiers died.\n", IF);
713 
714       IF = FRND(A[K][18]/3.0);
715       A[K][18] -= IF;
716       printf("%.0f nobles died.\n", IF);
717 
718       PAUSE(10000);
719    }
720 
721    // Line 69
722 
723    DS = 0.0;
724    IQ = 1;
725 
726    LA = A[K][1] - A[K][3] - A[K][18]*2.0 - A[K][16] - A[K][7] - A[K][15]*2.0;
727    PD = (A[K][3] + A[K][7] + A[K][18]*3.0) * 5.0;
728    AD = A[K][15] * 8.0;
729 
730    A[K][19] = 15.0;
731 
732    player_promotion();
733    if (KK == 1) return;
734 
735    // Line 73
736 
737    LA = fmin(A[K][2]*3.0, LA);
738    LA = fmin(A[K][3]*5.0, LA);
739 
740    A[K][2] -= LA/3.0;
741 
742    RA = FRND(30.0);
743    A[K][2] -= A[K][2]*RA/100.0;
744 
745    HA = fmax(LA * NW * 0.72 + FRND(500) - A[K][13] * 500.0, 0.0);
746    A[K][2] += HA;
747 
748    // Line 81
749    // GRAIN REPORT
750 
751    do
752    {
753       print_grain_report();
754       puts("");
755 
756       do { INPUT("0) Skip 1) Buy grain  2) Sell grain  3) Sell land ? ", "%d", &H); } while ((H < 0) || (H > 3));
757       puts("");
758 
759       action_grain_report();
760    }
761    while (H != 0);
762 
763    // Line 141
764 
765    do
766    {
767       printf("\nHow many bushels will you give to your army of %.0f men? ", A[K][15]);
768 
769       INPUT("", "%30[0-9.-]", buf);
770       HM = atof(buf);
771 
772       FLAG = HM > A[K][2];
773 
774       if (FLAG)
775          puts("You cannot give your army more grain than you have!");
776    }
777    while (FLAG || (HM < 0.0));
778 
779    A[K][2] -= HM;
780 
781    // Line 147
782 
783    PO = A[K][3] + A[K][7] + A[K][18];
784 
785    do
786    {
787       printf("How many bushels will you give to your %.0f people? ", PO);
788 
789       INPUT("", "%30[0-9.-]", buf);
790       HS = atof(buf);
791 
792       FLAG = HS > A[K][2];
793 
794       if (FLAG)
795          printf("But you only have %.1f bushels of grain!\n", A[K][2]);
796 
797       if (HS < A[K][2]*0.1)
798       {
799          FLAG = 1;
800          puts("You must release at least 10% of the stored grain\n");
801       }
802    }
803    while (FLAG || (HS < 0));
804 
805    A[K][2] -= HS;
806    A[K][19] = fmin(fmax(HM/(AD+0.001)*10.0, 5.0), 15.0);
807 
808    // Line 155
809    // POPULATION GROWTH
810 
811    CLS();
812    printf("%s %s of %s\nIn Year %d,\n", Z[K][(int)A[K][17]], Z[K][0], Z[K][1], NY);
813 
814    DB = FRND(PO/9.5); DM = 0.0; DD = FRND(PO/22.0); DE = 0.0;
815 
816    if ((HS > PD*1.5) && ((D = sqrt(HS-PD) - RND(A[K][8]*1.5)) >= 0.0))
817       DE = FRND(2.0*D+1.0);
818 
819    // Line 161
820 
821    DS = 0.0;
822 
823    if (PD > HS*2.0)
824    {
825       DS = FRND(PO/16.0+1.0);
826       DM = FRND(PO/12.0+1.0);
827    }
828    else if (PD > HS)
829       DM = FRND(PO/15.0+1.0);
830 
831    // Line 165
832 
833    PT = DB - DS - DM - DD + DE;
834    I1 = FRND(DE/5.0);
835    I2 = FRND(DE/25.0);
836 
837    A[K][7]  += I1;
838    A[K][18] += I2;
839    A[K][3]  += PT - I1 - I2;
840 
841    DA = 0.0;
842    if (AD > HM*2.0)
843    {
844       DA = FRND(A[K][15]/2.0+1.0);
845       A[K][15] -= DA;
846    }
847 
848    PA = 0.0;
849    if (AD > HM*2.0)
850    {
851       PA = RND(A[K][15]/5.0);
852       A[K][15] -= PA;
853    }
854 
855    printf("\n%.0f babies were born.\n", DB);
856    printf("%.0f people died of disease.\n", DD);
857 
858    if (DE > 0.0) printf("%.0f people immigrated into your country.\n", DE);
859    if (DM > 0.0) printf("%.0f people died of malnutrition.\n", DM);
860    if (DS > 0.0) printf("%.0f people starved to death.\n", DS);
861    if (DA > 0.0) printf("%.0f soldiers starved to death.\n", DA);
862 
863    printf("\nYour army will fight at %.0f%% efficiency.\n", A[K][19]*10.0);
864    printf("Your population %s %.0f citizens.\n", (PT < 0.0) ? "lost" : "gained", fabs(PT));
865 
866    printf("\n\n<Enter>");
867    PAUSE(30000);
868 
869    // Line 373
870    // UNFORTUNATE DEATH
871 
872    FLAG = RND(DS) > RND(110.0);
873 
874    if (FLAG || (RND0() <= 0.01))
875    {
876       unfortunate_death(FLAG);
877       return;
878    }
879 
880    // Line 189
881 
882 //   F1 = (A[K][11] * ((A[K][7] + RND(35.0) + RND(35.0)) / (A[K][9] + 1.0) * 12.0 + 5.0)) * 0.9;
883 //   F2 = (A[K][12] * (5.8*(HA + RND(250.0)) / (A[K][10]*20.0 + A[K][9]*40.0 + 10.0) + 150.0)) * 0.9;
884 //   F3 = (A[K][13] * (A[K][15] + RND(150.0) + 400.0)) * 0.9;
885 //   F4 = (A[K][14] * (A[K][7]*4.0 + A[K][11]*9.0 + A[K][13]*15.0) * NW) * 0.9;
886 //   F5 = -A[K][15] * 8.0;
887 
888    F1 = pow(A[K][11] * ((A[K][7] + RND(35.0) + RND(35.0)) / (A[K][9] + 1.0) * 12.0 + 5.0), 0.9);
889    F2 = pow(A[K][12] * (5.8*(HA + RND(250.0)) / (A[K][10]*20.0 + A[K][9]*40.0 + 10.0) + 150.0), 0.9);
890    F3 = pow(A[K][13] * (A[K][15] + RND(150.0) + 400.0), 0.9);
891    F4 = pow(A[K][14] * (A[K][7]*4.0 + A[K][11]*9.0 + A[K][13]*15.0) * NW, 0.9);
892    F5 = -A[K][15] * 8.0;
893 
894 //   FC = DE * (RND(40.0) + RND(40.0))/100.0 * A[K][8];
895 //   FS = A[K][9]/100.0 * ((A[K][7]*1.8 + F1*33.0 + F2*17.0 + F3*50.0 + F4*70.0)*0.85 + A[K][18]*5.0 + A[K][3]);
896 //   FI = (A[K][10]/100.0 * (A[K][3]*1.3 + A[K][18]*145.0 + A[K][7]*39.0 + A[K][11]*99.0 + A[K][12]*99.0 + A[K][13]*425.0 + A[K][14]*965.0)) * 0.97;
897 
898    FC = DE * (RND(40.0) + RND(40.0))/100.0 * A[K][8];
899    FS = A[K][9]/100.0 * (pow(A[K][7]*1.8 + F1*33.0 + F2*17.0 + F3*50.0 + F4*70.0, 0.85) + A[K][18]*5.0 + A[K][3]);
900    FI = pow(A[K][10]/100.0 * (A[K][3]*1.3 + A[K][18]*145.0 + A[K][7]*39.0 + A[K][11]*99.0 + A[K][12]*99.0 + A[K][13]*425.0 + A[K][14]*965.0), 0.97);
901 
902    A[K][4] += F1 + F2 + F3 + F4 + F5 + FC + FS + FI;
903    A[K][18] = floor(A[K][18]);
904 
905    // Line 199
906    // REVENUE REPORT
907 
908    while (1)
909    {
910       print_revenue_report();
911       puts("");
912 
913       do { INPUT("0) Skip 1) Customs duty  2) Sales tax  3) Income tax ? ", "%d", &E); } while ((E > 3) || (E < 0));
914       puts("");
915 
916       if (E == 0) break;
917 
918       do
919       {
920          INPUT(tax_query[E-1].s, "%30[0-9.-]", buf);
921          E1 = atof(buf);
922       }
923       while ((E1 < 0.0) || (E1 > tax_query[E-1].max));
924 
925       A[K][E+7] = E1;
926    }
927 
928    // Line 229
929 
930    while (1)
931    {
932       puts("");
933       do { INPUT("Any new investments (give #)? ", "%d", &E); } while ((E > 6) || (E < 0));
934 
935       if (E == 0) break;
936 
937       J = H = 0;
938       switch (E)
939       {
940          case 1:
941             E1 = 1000.0;
942             J  = RND(7);
943             break;
944 
945          case 2:
946             E1 = 2000.0;
947             break;
948 
949          case 3:
950             E1 = 7000.0;
951             break;
952 
953          case 4:
954             E1 = 8000.0;
955             break;
956 
957          case 5:
958             E1 = 8.0;
959             break;
960 
961          case 6:
962             E1 = 5000.0;
963             H  = RND(4);
964             break;
965 
966          default:
967             break;
968       }
969 
970       // Line 245
971 
972       do
973       {
974          FLAG = 0;
975 
976          do
977          {
978             INPUT("How many? ", "%30[0-9.-]", buf);
979             E2 = floor(atof(buf));
980          }
981          while (E2 < 0.0);
982 
983          if (E2 == 0.0) break;
984 
985          if (A[K][4] < E1*E2)
986          {
987             FLAG = 1;
988             printf("Think again . . .You only have %.2f %s\n", A[K][4], Z[K][6]);
989             continue;
990          }
991 
992          if ((E2+(E2-1.0)*(J+H)) > A[K][3])
993          {
994             FLAG = 1;
995             printf("You don't have enough serfs to train\n");
996             continue;
997          }
998 
999          if ((E1 == 8.0) && (((E2+A[K][15])/PO) > (0.05+A[K][13]*0.015)))
1000          {
1001             FLAG = 1;
1002             printf("You cannot equip and maintain so many troops, %s.\n", Z[K][(int)A[K][17]]);
1003             continue;
1004          }
1005 
1006          A[K][15] = floor(A[K][15]);
1007 
1008          if ((E1 == 8.0) && ((E2+A[K][15]) > (A[K][18]*20.0)))
1009          {
1010             FLAG = 1;
1011             printf("Please think again . . .  You only have %.0f nobles\nto lead your troops.\n", A[K][18]);
1012             continue;
1013          }
1014       }
1015       while (FLAG);
1016 
1017       if (E1 == 8.0)
1018          A[K][3]  -= E2;
1019       else
1020       {
1021          A[K][7]  += J*E2;
1022          A[K][18] += H*E2;
1023          A[K][3]  -= (J+H)*E2;
1024       }
1025 
1026       // Line 255
1027 
1028       A[K][4]    -= E2*E1;
1029       A[K][E+10] += E2;
1030 
1031       print_revenue_report();
1032    }
1033 
1034    // Line 257
1035    // BATTLE REPORT
1036 
1037    while (1)
1038    {
1039       print_battle_report();
1040 
1041       do
1042       {
1043          FLAG = 0;
1044          do { INPUT("\nWho do you wish to attack (give #)? ", "%d", &I); } while ((I > 7) || (I < 0));
1045 
1046          if (I == 0) break;
1047 
1048          if (I == K+1)
1049          {
1050             FLAG = 1;
1051             printf("%s, please think again.  You are #%d!\n", Z[K][(int)A[K][17]], I);
1052             continue;
1053          }
1054 
1055          if ((I > 1) && (NY < 3))
1056          {
1057             FLAG = 1;
1058             puts("Due to international treaty, you cannot attack other\nnations until the third year.\n");
1059             continue;
1060          }
1061 
1062          if ((I == 1) && (BA < 1.0))
1063          {
1064             FLAG = 1;
1065             puts("All barbarian lands have been seized.\n");
1066             BA = 0.0;
1067             continue;
1068          }
1069 
1070          if ((int)A[I-1][0] != 0)
1071          {
1072             FLAG = 1;
1073             puts("That player is no longer in the game.\n");
1074             continue;
1075          }
1076 
1077          H = (int)(A[K][18]/4.0) + 1;
1078 
1079          if (IQ > H)
1080          {
1081             FLAG = 1;
1082             printf("Due to a shortage of nobles, you are limited to\nonly %d attacks per year.\n", H);
1083             continue;
1084          }
1085       }
1086       while (FLAG);
1087 
1088       if (I-- == 0) break;
1089 
1090       FLAG = 0;
1091       do
1092       {
1093          INPUT("How many soldiers do you want to send? ", "%30[0-9.-]", buf);
1094          I1 = atof(buf);
1095 
1096          FLAG = I1 > A[K][15];
1097 
1098          if (FLAG)
1099             printf("Think again... You have only %.0f soldiers\n", A[K][15]);
1100       }
1101       while (FLAG || (I1 < 0.0));
1102 
1103       // Line 279
1104 
1105       if (I1 > 0.0)
1106       {
1107          ++IQ;
1108          battle();
1109       }
1110    }
1111 }
1112 
player_computer(void)1113 void player_computer(void)
1114 {
1115    for (Q=1; Q<=NP; ++Q)
1116       if ((int)A[Q][0] == 0) break;
1117 
1118    if (Q > NP) exit(1);
1119    if ((int)A[K][0] != 0) return;
1120 
1121    DS = 0.0;
1122 
1123    CLS();
1124 
1125    printf("One moment -- %s %s's turn . . .\n", Z[K][(int)A[K][17]], Z[K][0]);
1126    PAUSE(3000);
1127 
1128    if (RND0() < 0.01)
1129    {
1130       unfortunate_death(0);
1131       return;
1132    }
1133 
1134    Q0 = Q2 = Q3 = Q4 = Q5 = Q6 = Q7 = Q8 = Q9 = 0.0;
1135    QB = QC = QD = 0.0;
1136 
1137    QP = 0;
1138    for (Q=1; Q<=NP; ++Q)
1139    {
1140       if ((int)A[Q][0] == 0)
1141       {
1142          ++QP;
1143 
1144          Q2 += A[Q][3];
1145          Q3 += A[Q][5];
1146          Q4 += A[Q][6];
1147          Q5 += A[Q][4];
1148          Q6 += A[Q][7];
1149          Q7 += A[Q][11];
1150          Q8 += A[Q][12];
1151          Q9 += A[Q][13];
1152          Q0 += A[Q][14];
1153 
1154          QB += A[Q][16];
1155          QC += A[Q][18];
1156          QD += A[Q][19];
1157       }
1158    }
1159 
1160    // Line 431
1161 
1162    Q2 /= QP; Q3 /= QP; Q4 /= QP; Q5 /= QP; Q6 /= QP; Q7 /= QP; Q8 /= QP; Q9 /= QP; Q0 /= QP;
1163    QB /= QP; QC /= QP; QD /= QP;
1164 
1165    do
1166    {
1167       Q2  = floor(Q2 + RND(200.0) - RND(200.0));
1168       Q3  = floor(Q3 + RND(1000.0) - RND(1000.0));
1169       Q4  = Q4 + RND0() - RND0();
1170       Q5  = floor(Q5 + RND(1500.0) - RND(1500.0));
1171       Q6  = floor(Q6 + RND(25.0) - RND(25.0));
1172 
1173       if (Q4 < 0.0) Q4 = 0.0;
1174    }
1175    while (Q4 == 0.0);
1176 
1177    Q7 = floor(Q7 + RND(4.0) - RND(4.0));
1178    Q8 = floor(Q8 + RND(2.0) - RND(2.0));
1179 
1180    if (RND0() < 0.3)
1181    {
1182       Q9 = floor(Q9 + RND(2.0) - RND(2.0));
1183       Q0 = floor(Q0 + RND(2.0) - RND(2.0));
1184 
1185       if (RND0() < 0.5)
1186       {
1187          QB = floor(QB + RND(2.0) - RND(2.0));
1188          QC = floor(QC + RND(2.0) - RND(2.0));
1189       }
1190    }
1191 
1192    // Line 437
1193 
1194    A[K][3] = Q2;
1195 
1196    if ((Q3 > A[K][5]) && (RND(9.0) > 6.0))
1197    {
1198       A[K][5] = Q3;
1199       A[K][6] = Q4;
1200 
1201       if (NW < 3) A[K][6] += RND0()/1.5;
1202    }
1203 
1204    A[K][4] = Q5;
1205 
1206    if (Q6 > A[K][7])  A[K][7]  = Q6;
1207    if (Q7 > A[K][11]) A[K][11] = Q7;
1208    if (Q8 > A[K][12]) A[K][12] = Q8;
1209    if (Q9 > A[K][13]) A[K][13] = Q9;
1210    if (Q0 > A[K][14]) A[K][14] = Q0;
1211    if (QB > A[K][16]) A[K][16] = QB;
1212    if (QC > A[K][18]) A[K][18] = QC;
1213 
1214    A[K][15] = 10.0*A[K][18] + RND(10.0*A[K][18]);
1215    IQ = 0;
1216 
1217    while ((A[K][15]/Q2) > (A[K][13]*0.01+0.05))
1218       A[K][15] /= 2.0;
1219 
1220    A[K][19] = QD;
1221 
1222    QF = 1;
1223    player_promotion();
1224    QF = 0;
1225 
1226    do { Q = RND(NP); } while (((int)A[Q][0] != 0) || (Q == K));
1227 
1228    if (A[Q][5] >= 1.0)
1229    {
1230       do
1231       {
1232          QR = RND(O)*A[Q][5];
1233 
1234          if ((QR*A[Q][6]) < A[K][4])
1235          {
1236             A[Q][4] += floor(QR*A[Q][6]*90.0)/100.0;
1237             A[Q][5] -= floor(QR);
1238 
1239             break;
1240          }
1241       }
1242       while (RND(9.0) > 3.0);
1243    }
1244 
1245    do
1246    {
1247       if (RND(9.0) < 2.0) return;
1248 
1249       if (NY >= 3)
1250       {
1251          do { I = RND(6); } while ((I == K) || ((int)A[I][0] != 0));
1252       }
1253       else
1254       {
1255          I = 0;
1256          if (BA <= 0.0) return;
1257       }
1258 
1259       // Line 477
1260 
1261       I1 = FRND(A[K][15]);
1262 
1263       QF = 1;
1264       battle();
1265       QF = 0;
1266 
1267       ++IQ;
1268    }
1269    while ((A[K][15] > 30.0) && (IQ < A[K][18]/4.0));
1270 }
1271 
1272 #ifdef INSTR
1273 
1274 extern const char inst[];
1275 
instructions(void)1276 void instructions(void)
1277 {
1278    char *p;
1279 
1280    CLS();
1281 
1282    for (p=inst; *p != '\0'; ++p)
1283    {
1284       if (*p == '*')
1285          PAUSE(1000);
1286       else if (*p == '@')
1287       {
1288          PAUSE(0);
1289          CLS();
1290       }
1291       else if (*p == '<')
1292          puts("");
1293       else
1294       {
1295          putchar(*p);
1296          in_pause(25);
1297       }
1298    }
1299 }
1300 
1301 #endif
1302 
1303 char *main_weather[] = {
1304    "",
1305    "Poor weather. No rain. Locusts migrate.",
1306    "Early frosts. Arid conditions.",
1307    "Flash floods. Too much rain.",
1308    "Average weather. Good year.",
1309    "Fine weather. Long summer.",
1310    "Fantastic weather! Great year!"
1311 };
1312 
main(void)1313 void main(void)
1314 {
1315 #ifdef __SPECTRUM
1316    ioctl(1, IOCTL_OTERM_PAUSE, 0);
1317 #endif
1318 
1319    // Line 0
1320 
1321    CLS();
1322 
1323    puts("E M P I R E\n\n");
1324    puts("(Always hit <enter> to continue)\n");
1325 
1326    in_wait_nokey();
1327    for (I=0; !in_test_key(); ++I) ;
1328    in_wait_nokey();
1329 
1330    srand(I);
1331 
1332 #ifdef INSTR
1333 
1334    do
1335    {
1336       INPUT("Instructions? (y/n) ", "%2s", buf);
1337       *buf = toupper(*buf);
1338    }
1339    while ((*buf != 'Y') && (*buf != 'N'));
1340 
1341    if (*buf == 'Y') instructions();
1342 
1343 #endif
1344 
1345    CLS();
1346 
1347    // Line 9
1348 
1349    for (I=1; I<=6; ++I)
1350       A[I][2] += FRND(10000);
1351 
1352    do { INPUT("How many people are playing? ", "%d", &NP); } while ((NP < 0) || (NP > 6));
1353 
1354    puts("");
1355    for (I=1; I<=NP; ++I)
1356    {
1357       printf("%d - Who is the ruler of %s? ", I, Z[I][1]);
1358       INPUT("", "%11s", buf);
1359       Z[I][0] = strdup(buf);
1360    }
1361 
1362    // Line 19
1363 
1364    do
1365    {
1366       CLS();
1367 
1368       printf("Year %d\n\n", ++NY);
1369       puts(main_weather[NW = RND(6)]);
1370 
1371       // Line 35
1372 
1373       PAUSE(5000);
1374 
1375       for (K=1; K<=6; ++K)
1376       {
1377          (K > NP) ? player_computer() : player_human();
1378          if (KK == 1) break;
1379       }
1380 
1381       // Line 43
1382 
1383       CLS();
1384 
1385       puts("Summary");
1386       puts("Nobles   Soldiers   Merchants   Serfs   Land    Palace\n");
1387 
1388       for (I=1; I<=6; ++I)
1389       {
1390          if ((int)A[I][0] == 0)
1391          {
1392             printf("%s %s of %s\n", Z[I][(int)A[I][17]], Z[I][0], Z[I][1]);
1393             printf("%4.0f%12.0f%12.0f%10.0f%8.0f%5.0f%%\n", A[I][18], A[I][15], A[I][7], A[I][3], A[I][1], A[I][16]*10.0);
1394          }
1395       }
1396 
1397       puts("\n<Enter>");
1398       PAUSE(30000);
1399    }
1400    while (KK != 1);
1401 }
1402 
1403 #ifdef INSTR
1404 
1405 const char inst[] = "  Hello!     Welcome to  E M P I R E . . .*<<"
1406    "Imagine yourself to be the ruler of a small, unimportant piece<"
1407    "of European land way back in the medieval ages. Your country is<"
1408    "beset by many problems - no industry, little trade, small army"
1409    ",<underpopulation, angry neighbors, plague, and all the other<"
1410    "day-to-day problems a capable leader must learn to face. Am-<"
1411    "bitious by necessity, you must aquire land, capital, and an<"
1412    "army just to survive. Because of the short lifetimes back then,<"
1413    "you'll have only a limited amount of time to build your coun-<"
1414    "try into an empire.<<  Competent rule will gradually be rewarded "
1415    "with lofty titles -<Knight, Prince, King, and finally  -- Emperor"
1416    " --@  Sounds easy?  Then consider this - five other city-states "
1417    "are<also struggling to become the emperor, and they don't just in-"
1418    "<tend to passively watch you win. They control armies which can<"
1419    "attack at a moments notice, and perhaps devastate your country.<"
1420    "They control the grain market, and if you think OPEC is bad,<"
1421    "just wait and see how scarce and expensive grain can become.<<"
1422    "  Of course, a competent ruler could make a killing on the<"
1423    "grain market. With proper planning, your harvests should be<"
1424    "plentiful. You could solve overpopulation problems by raising a<"
1425    "large army to be killed off in battle.<<  Nevertheless, your overriding"
1426    " concern should be lebensraum -<living room. There is only a limited "
1427    "amount of land to be con-<quered. If you can defeat the barbarian "
1428    "hordes, and the well-<trained standing armies of the other nations, "
1429    "and then defeat<their peasant militias, perhaps you may attain "
1430    "the well deser-<ved title of Emperor.@Taxes:<<  The customs tax "
1431    "applies only to immigrants to your nation.<Often, lower customs "
1432    "tax means more immigrants.<<  The sales tax is closely intertwined "
1433    "into your capitalist<economy. While it has the potential of raising "
1434    "lots of money,<overly high taxes tend to stifle industrial profits.<<"
1435    "  Income taxes are paid by all inhabitants and industry. Again,<"
1436    "lower income tax often means increased industrial output."
1437    "<<  You have the option each year to invest your earnings in<"
1438    "different types of trade and industry. In the years to follow,<"
1439    "these investments, if managed correctly, will more than pay<"
1440    "for themselves.@Types of investments:<<  Marketplaces are a "
1441    "relatively cheap investment that are quite<profitable because "
1442    "they encourage the formation of a middle<class - the merchants. "
1443    "And, as you are probably aware, the<middle class pays an inordinate "
1444    "share of taxes.<<  Grain mills are necessary to process the harvest, "
1445    "and con-<sequently, usually do quite well when there is a large "
1446    "harvest.<<  Foundries are necessary for the creation of large armies.<"
1447    "Several of them will allow you to equip a much larger army<than otherwise.<<"
1448    "  Shipyards have the greatest profit potential of all invest-<ments. "
1449    "Because of a larger volume of orders during good wea-<ther, there is "
1450    "often a better return during these years.@  Armies are never a profitable "
1451    "investment. Besides costing<a large initial investment, they also cost "
1452    "a lot to maintain<and train. In addition, they also require a greater "
1453    "fraction<of the harvest than serfs.<<  Of course, one should give himself "
1454    "the luxury of building a<palace. What else could distinguish an emperor "
1455    "from all the<other kings with their castles, than a palace? Also, with a<"
1456    "palace, your country will begin to attract more nobles.<<Other general "
1457    "hints:<<  You always lose 10% as a brokerage fee when dealing on the<"
1458    "grain market. When you sell your grain at different prices,<"
1459    "the market price is the weighted average of the sales prices<(this "
1460    "helps to prevent large yearly price fluctuations). To<prevent "
1461    "those unscrupulous rulers who try to use the market as<"
1462    "a method to avoid the rats, you can't buy back your own grain.@"
1463    "Also, leave a portion of your grain reserve for planting for<next "
1464    "year's harvest.<<Often, it is beneficial to feed your people much "
1465    "more than they<require. Immigrants are usually attracted to a "
1466    "prosperous nat-<ion, and sometimes, even merchants and nobles move in.<"
1467    "<<  Up to six people can play this game. Rulers not played by<humans "
1468    "will be played by your TRS-80, with its playing abil-<ity based on "
1469    "the average of the human players.@Winning:<<To become a prince, you "
1470    "must pass these rather stringent<qualifications:8 marketplaces, "
1471    "4 mills, palace 20% completed,<a land-over-serf ratio of 4.8, over "
1472    "10 nobles, and over 2300<serfs.<<To become a king, you must have:"
1473    "14 marketplaces, 6 mills,<palace 60% completed, 1 foundry, land-over-serf "
1474    "ratio of at<least 5.0, Over 2600 serfs and 25 nobles.<<To become an "
1475    "+EMPEROR+ you must meet all of the above qual-<ifications, and ....over "
1476    "3100 serfs and 40 nobles.<<<-- Good luck, future rulers@";
1477 
1478 #endif
1479