6 /* Finish with a BANG! */
\r
8 if (damage[DCOMPTR] != 0.0) {
\r
9 prout("Computer damaged; cannot execute destruct sequence.");
\r
13 prouts("---WORKING---"); skip(1);
\r
14 prout("SELF-DESTRUCT-SEQUENCE-ACTIVATED");
\r
15 prouts(" 10"); skip(1);
\r
16 prouts(" 9"); skip(1);
\r
17 prouts(" 8"); skip(1);
\r
18 prouts(" 7"); skip(1);
\r
19 prouts(" 6"); skip(1);
\r
20 prout("ENTER-CORRECT-PASSWORD-TO-CONTINUE-");
\r
21 prout("SELF-DESTRUCT-SEQUENCE-OTHERWISE-");
\r
22 prout("SELF-DESTRUCT-SEQUENCE-WILL-BE-ABORTED");
\r
25 if (strcmp(passwd, citem) != 0) {
\r
26 prouts("PASSWORD-REJECTED;"); skip(1);
\r
27 prout("CONTINUITY-EFFECTED");
\r
31 prouts("PASSWORD-ACCEPTED"); skip(1);
\r
32 prouts(" 5"); skip(1);
\r
33 prouts(" 4"); skip(1);
\r
34 prouts(" 3"); skip(1);
\r
35 prouts(" 2"); skip(1);
\r
36 prouts(" 1"); skip(1);
\r
37 if (Rand() < 0.15) {
\r
38 prouts("GOODBYE-CRUEL-WORLD");
\r
47 if (ship==IHE) prouts("***");
\r
48 prouts("********* Entropy of ");
\r
50 prouts(" maximized *********");
\r
55 double whammo = 25.0 * energy;
\r
57 while (l <= nenhere) {
\r
58 if (kpower[l]*kdist[l] <= whammo)
\r
59 deadkl(kx[l],ky[l], frozen.quad[kx[l]][ky[l]], kx[l], ky[l]);
\r
67 void finish(FINTYPE ifin) {
\r
71 printf("It is stardate %.1f .\n\n", state.date);
\r
73 case FWON: // Game has been won
\r
74 if (state.nromrem != 0)
\r
75 printf("The remaining %d Romulans surrender to Starfleet Command.\n",
\r
78 prout("You have smashed the Klingon invasion fleet and saved");
\r
79 prout("the Federation.");
\r
83 badpt = 5.*state.starkl + casual + 10.*state.nplankl +
\r
84 45.*nhelp+100.*state.basekl;
\r
85 if (ship == IHF) badpt += 100.0;
\r
86 else if (ship == 0) badpt += 200.0;
\r
87 if (badpt < 100.0) badpt = 0.0; // Close enough!
\r
88 if (state.date-indate < 5.0 ||
\r
89 // killsPerDate >= RateMax
\r
90 (state.killk+state.killc+state.nsckill)/(state.date-indate) >=
\r
91 0.1*skill*(skill+1.0) + 0.1 + 0.008*badpt) {
\r
93 prout("In fact, you have done so well that Starfleet Command");
\r
96 prout("promotes you one step in rank from \"Novice\" to \"Fair\".");
\r
99 prout("promotes you one step in rank from \"Fair\" to \"Good\".");
\r
102 prout("promotes you one step in rank from \"Good\" to \"Expert\".");
\r
105 prout("promotes you to Commodore Emeritus.");
\r
107 prout("Now that you think you're really good, try playing");
\r
108 prout("the \"Emeritus\" frozen. It will splatter your ego.");
\r
112 prout("Computer- ERROR-ERROR-ERROR-ERROR");
\r
114 prout(" YOUR-SKILL-HAS-EXCEEDED-THE-CAPACITY-OF-THIS-PROGRAM");
\r
115 prout(" THIS-PROGRAM-MUST-SURVIVE");
\r
116 prout(" THIS-PROGRAM-MUST-SURVIVE");
\r
117 prout(" THIS-PROGRAM-MUST-SURVIVE");
\r
118 prout(" THIS-PROGRAM-MUST?- MUST ? - SUR? ? -? VI");
\r
120 prout("Now you can retire and write your own Star Trek game!");
\r
130 prout("You cannot get a citation, so...");
\r
132 prout("Do you want your Commodore Emeritus Citation printed?");
\r
133 proutn("(You need a 132 column printer.)");
\r
141 // Only grant long life if alive (original didn't!)
\r
143 prout("LIVE LONG AND PROSPER.");
\r
146 if (igotit != 0) plaque();
\r
148 case FDEPLETE: // Federation Resources Depleted
\r
149 prout("Your time has run out and the Federation has been");
\r
150 prout("conquered. Your starship is now Klingon property,");
\r
151 prout("and you are put on trial as a war criminal. On the");
\r
152 proutn("basis of your record, you are ");
\r
153 if (state.remkl*3.0 > inkling) {
\r
154 prout("aquitted.");
\r
156 prout("LIVE LONG AND PROSPER.");
\r
159 prout("found guilty and");
\r
160 prout("sentenced to death by slow torture.");
\r
166 prout("Your life support reserves have run out, and");
\r
167 prout("you die of thirst, starvation, and asphyxiation.");
\r
168 prout("Your starship is a derelict in space.");
\r
171 prout("Your energy supply is exhausted.");
\r
173 prout("Your starship is a derelict in space.");
\r
178 prout("has been destroyed in battle.");
\r
180 prout("Dulce et decorum est pro patria mori.");
\r
183 prout("You have made three attempts to cross the negative energy");
\r
184 prout("barrier which surrounds the galaxy.");
\r
186 prout("Your navigation is abominable.");
\r
190 prout("Your starship has been destroyed by a nova.");
\r
191 prout("That was a great shot.");
\r
197 prout(" has been fried by a supernova.");
\r
198 prout("...Not even cinders remain...");
\r
201 prout("You have been captured by the Klingons. If you still");
\r
202 prout("had a starbase to be returned to, you would have been");
\r
203 prout("repatriated and given another chance. Since you have");
\r
204 prout("no starbases, you will be mercilessly tortured to death.");
\r
207 prout("Your starship is now an expanding cloud of subatomic particles");
\r
210 prout("Starbase was unable to re-materialize your starship.");
\r
211 prout("Sic transit gloria muntdi");
\r
216 prout(" has been cremated by its own phasers.");
\r
219 prout("You and your landing party have been");
\r
220 prout("converted to energy, disipating through space.");
\r
223 prout("You are left with your landing party on");
\r
224 prout("a wild jungle planet inhabited by primitive cannibals.");
\r
226 prout("They are very fond of \"Captain Kirk\" soup.");
\r
228 proutn("Without your leadership, the ");
\r
230 prout(" is destroyed.");
\r
233 prout("You and your mining party perish.");
\r
235 prout("That was a great shot.");
\r
239 prout("The Galileo is instantly annihilated by the supernova.");
\r
242 prout("You and your mining party are atomized.");
\r
244 proutn("Mr. Spock takes command of the ");
\r
247 prout("joins the Romulans, reigning terror on the Federation.");
\r
250 prout("The shuttle craft Galileo is also caught,");
\r
251 prout("and breaks up under the strain.");
\r
253 prout("Your debris is scattered for millions of miles.");
\r
254 proutn("Without your leadership, the ");
\r
256 prout(" is destroyed.");
\r
259 prout("The mutants attack and kill Spock.");
\r
260 prout("Your ship is captured by Klingons, and");
\r
261 prout("your crew is put on display in a Klingon zoo.");
\r
264 prout("Tribbles consume all remaining water,");
\r
265 prout("food, and oxygen on your ship.");
\r
267 prout("You die of thirst, starvation, and asphyxiation.");
\r
268 prout("Your starship is a derelict in space.");
\r
271 prout("Your ship is drawn to the center of the black hole.");
\r
272 prout("You are crushed into extremely dense matter.");
\r
275 if (ship==IHF) ship= 0;
\r
276 else if (ship == IHE) ship = IHF;
\r
278 if (state.remkl != 0) {
\r
279 double goodies = state.remres/inresor;
\r
280 double baddies = (state.remkl + 2.0*state.remcom)/(inkling+2.0*incom);
\r
281 if (goodies/baddies >= 1.0+0.5*Rand()) {
\r
282 prout("As a result of your actions, a treaty with the Klingon");
\r
283 prout("Empire has been signed. The terms of the treaty are");
\r
284 if (goodies/baddies >= 3.0+Rand()) {
\r
285 prout("favorable to the Federation.");
\r
287 prout("Congratulations!");
\r
290 prout("highly unfavorable to the Federation.");
\r
293 prout("The Federation will be destroyed.");
\r
296 prout("Since you took the last Klingon with you, you are a");
\r
297 prout("martyr and a hero. Someday maybe they'll erect a");
\r
298 prout("statue in your memory. Rest in peace, and try not");
\r
299 prout("to think about pigeons.");
\r
306 double timused = state.date - indate;
\r
307 int ithperd, iwon, klship;
\r
312 if ((timused == 0 || state.remkl != 0) && timused < 5.0) timused = 5.0;
\r
313 perdate = (state.killc + state.killk + state.nsckill)/timused;
\r
314 ithperd = 500*perdate + 0.5;
\r
316 if (gamewon) iwon = 100*skill;
\r
317 if (ship == IHE) klship = 0;
\r
318 else if (ship == IHF) klship = 1;
\r
320 if (gamewon == 0) state.nromrem = 0; // None captured if no win
\r
321 iscore = 10*state.killk + 50*state.killc + ithperd + iwon
\r
322 - 100*state.basekl - 100*klship - 45*nhelp -5*state.starkl - casual
\r
323 + 20*state.nromkl + 200*state.nsckill - 10*state.nplankl + state.nromrem;
\r
324 if (alive == 0) iscore -= 200;
\r
326 prout("Your score --");
\r
328 printf("%6d Romulans destroyed %5d\n",
\r
329 state.nromkl,20*state.nromkl);
\r
331 printf("%6d Romulans captured %5d\n",
\r
332 state.nromrem, state.nromrem);
\r
334 printf("%6d ordinary Klingons destroyed %5d\n",
\r
335 state.killk, 10*state.killk);
\r
337 printf("%6d Klingon commanders destroyed %5d\n",
\r
338 state.killc, 50*state.killc);
\r
340 printf("%6d Super-Commander destroyed %5d\n",
\r
341 state.nsckill, 200*state.nsckill);
\r
343 printf("%6.2f Klingons per stardate %5d\n",
\r
346 printf("%6d stars destroyed by your action %5d\n",
\r
347 state.starkl, -5*state.starkl);
\r
349 printf("%6d planets destroyed by your action %5d\n",
\r
350 state.nplankl, -10*state.nplankl);
\r
352 printf("%6d bases destroyed by your action %5d\n",
\r
353 state.basekl, -100*state.basekl);
\r
355 printf("%6d calls for help from starbase %5d\n",
\r
358 printf("%6d casualties incurred %5d\n",
\r
361 printf("%6d ship(s) lost or destroyed %5d\n",
\r
362 klship, -100*klship);
\r
364 prout("Penalty for getting yourself killed -200");
\r
367 proutn("Bonus for winning ");
\r
369 case 1: proutn("Novice game "); break;
\r
370 case 2: proutn("Fair game "); break;
\r
371 case 3: proutn("Good game "); break;
\r
372 case 4: proutn("Expert game "); break;
\r
373 case 5: proutn("Emeritus game"); break;
\r
375 printf(" %5d\n", iwon);
\r
378 printf("TOTAL SCORE %5d\n", iscore);
\r
381 void plaque(void) {
\r
390 while (fp == NULL) {
\r
391 printf("File or device name for your plaque:");
\r
392 fgets(winner, 128, stdin);
\r
393 winner[strlen(winner)-1] = '\0';
\r
394 fp = fopen(winner, "w");
\r
396 printf("Invalid name.\n");
\r
400 printf("Enter name to go on plaque (up to 30 characters):");
\r
401 fgets(winner, 128, stdin);
\r
402 winner[strlen(winner)-1] = '\0';
\r
404 nskip = 64 - strlen(winner)/2;
\r
406 fprintf(fp,"\n\n\n\n");
\r
407 /* --------DRAW ENTERPRISE PICTURE. */
\r
408 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n" );
\r
409 fprintf(fp, " EEE E : : : E\n" );
\r
410 fprintf(fp, " EE EEE E : : NCC-1701 : E\n");
\r
411 fprintf(fp, " EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEE E : : : E\n");
\r
412 fprintf(fp, " E E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n");
\r
413 fprintf(fp, " EEEEEEEEE EEEEEEEEEEEEE E E\n");
\r
414 fprintf(fp, " EEEEEEE EEEEE E E E E\n");
\r
415 fprintf(fp, " EEE E E E E\n");
\r
416 fprintf(fp, " E E E E\n");
\r
417 fprintf(fp, " EEEEEEEEEEEEE E E\n");
\r
418 fprintf(fp, " EEE : EEEEEEE EEEEEEEE\n");
\r
419 fprintf(fp, " :E : EEEE E\n");
\r
420 fprintf(fp, " .-E -:----- E\n");
\r
421 fprintf(fp, " :E : E\n");
\r
422 fprintf(fp, " EE : EEEEEEEE\n");
\r
423 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEE\n");
\r
424 fprintf(fp, "\n\n\n");
\r
425 fprintf(fp, " U. S. S. ENTERPRISE\n");
\r
426 fprintf(fp, "\n\n\n\n");
\r
427 fprintf(fp, " For demonstrating outstanding ability as a starship captain\n");
\r
429 fprintf(fp, " Starfleet Command bestows to you\n");
\r
431 fprintf(fp,"%*s%s\n\n", nskip, "", winner);
\r
432 fprintf(fp, " the rank of\n\n");
\r
433 fprintf(fp, " \"Commodore Emeritus\"\n\n");
\r
436 case 4: fprintf(fp," Expert level\n\n"); break;
\r
437 case 5: fprintf(fp,"Emeritus level\n\n"); break;
\r
438 default: fprintf(fp," Cheat level\n\n"); break;
\r
441 timestring = ctime(&t);
\r
442 fprintf(fp, " This day of %.6s %.4s, %.8s\n\n",
\r
443 timestring+4, timestring+20, timestring+11);
\r
444 fprintf(fp," Your score: %d\n\n", iscore);
\r
445 fprintf(fp," Klingons per stardate: %.2f\n", perdate);
\r