7 /* Finish with a BANG! */
9 if (game.damage[DCOMPTR] != 0.0) {
10 prout("Computer damaged; cannot execute destruct sequence.");
13 prouts("---WORKING---"); skip(1);
14 prouts("SELF-DESTRUCT-SEQUENCE-ACTIVATED"); skip(1);
15 prouts(" 10"); skip(1);
16 prouts(" 9"); skip(1);
17 prouts(" 8"); skip(1);
18 prouts(" 7"); skip(1);
19 prouts(" 6"); skip(1);
21 prout("ENTER-CORRECT-PASSWORD-TO-CONTINUE-");
23 prout("SELF-DESTRUCT-SEQUENCE-OTHERWISE-");
25 prout("SELF-DESTRUCT-SEQUENCE-WILL-BE-ABORTED");
29 if (strcmp(game.passwd, citem) != 0) {
30 prouts("PASSWORD-REJECTED;"); skip(1);
31 prouts("CONTINUITY-EFFECTED");
35 prouts("PASSWORD-ACCEPTED"); skip(1);
36 prouts(" 5"); skip(1);
37 prouts(" 4"); skip(1);
38 prouts(" 3"); skip(1);
39 prouts(" 2"); skip(1);
40 prouts(" 1"); skip(1);
42 prouts("GOODBYE-CRUEL-WORLD");
51 if (ship==IHE) prouts("***");
52 prouts("********* Entropy of ");
54 prouts(" maximized *********");
59 double whammo = 25.0 * energy;
61 while (l <= nenhere) {
62 if (game.kpower[l]*game.kdist[l] <= whammo)
63 deadkl(game.kx[l],game.ky[l], game.quad[game.kx[l]][game.ky[l]], game.kx[l], game.ky[l]);
71 void finish(FINTYPE ifin)
76 prout("It is stardate %.1f.", game.state.date);
79 case FWON: // Game has been won
80 if (game.state.nromrem != 0)
81 prout("The remaining %d Romulans surrender to Starfleet Command.",
84 prout("You have smashed the Klingon invasion fleet and saved");
85 prout("the Federation.");
89 badpt = 5.0*game.state.starkl + casual + 10.0*game.state.nplankl +
90 45.*nhelp+100.*game.state.basekl;
91 if (ship == IHF) badpt += 100.0;
92 else if (ship == 0) badpt += 200.0;
93 if (badpt < 100.0) badpt = 0.0; // Close enough!
94 if (game.state.date-indate < 5.0 ||
95 // killsPerDate >= RateMax
96 KLINGKILLED/(game.state.date-indate) >=
97 0.1*skill*(skill+1.0) + 0.1 + 0.008*badpt) {
99 prout("In fact, you have done so well that Starfleet Command");
102 prout("promotes you one step in rank from \"Novice\" to \"Fair\".");
105 prout("promotes you one step in rank from \"Fair\" to \"Good\".");
108 prout("promotes you one step in rank from \"Good\" to \"Expert\".");
111 prout("promotes you to Commodore Emeritus.");
113 prout("Now that you think you're really good, try playing");
114 prout("the \"Emeritus\" game. It will splatter your ego.");
118 proutn("Computer- ");
119 prouts("ERROR-ERROR-ERROR-ERROR");
121 prouts(" YOUR-SKILL-HAS-EXCEEDED-THE-CAPACITY-OF-THIS-PROGRAM");
123 prouts(" THIS-PROGRAM-MUST-SURVIVE");
125 prouts(" THIS-PROGRAM-MUST-SURVIVE");
127 prouts(" THIS-PROGRAM-MUST-SURVIVE");
129 prouts(" THIS-PROGRAM-MUST?- MUST ? - SUR? ? -? VI");
131 prout("Now you can retire and write your own Star Trek game!");
135 if (skill >= SKILL_EXPERT) {
141 prout("You cannot get a citation, so...");
143 proutn("Do you want your Commodore Emeritus Citation printed? ");
151 // Only grant long life if alive (original didn't!)
153 prout("LIVE LONG AND PROSPER.");
156 if (igotit != 0) plaque();
158 case FDEPLETE: // Federation Resources Depleted
159 prout("Your time has run out and the Federation has been");
160 prout("conquered. Your starship is now Klingon property,");
161 prout("and you are put on trial as a war criminal. On the");
162 proutn("basis of your record, you are ");
163 if (KLINGREM*3.0 > INKLINGTOT) {
166 prout("LIVE LONG AND PROSPER.");
169 prout("found guilty and");
170 prout("sentenced to death by slow torture.");
176 prout("Your life support reserves have run out, and");
177 prout("you die of thirst, starvation, and asphyxiation.");
178 prout("Your starship is a derelict in space.");
181 prout("Your energy supply is exhausted.");
183 prout("Your starship is a derelict in space.");
188 prout("has been destroyed in battle.");
190 prout("Dulce et decorum est pro patria mori.");
193 prout("You have made three attempts to cross the negative energy");
194 prout("barrier which surrounds the galaxy.");
196 prout("Your navigation is abominable.");
200 prout("Your starship has been destroyed by a nova.");
201 prout("That was a great shot.");
207 prout(" has been fried by a supernova.");
208 prout("...Not even cinders remain...");
211 prout("You have been captured by the Klingons. If you still");
212 prout("had a starbase to be returned to, you would have been");
213 prout("repatriated and given another chance. Since you have");
214 prout("no starbases, you will be mercilessly tortured to death.");
217 prout("Your starship is now an expanding cloud of subatomic particles");
220 prout("Starbase was unable to re-materialize your starship.");
221 prout("Sic transit gloria muntdi");
226 prout(" has been cremated by its own phasers.");
229 prout("You and your landing party have been");
230 prout("converted to energy, disipating through space.");
233 prout("You are left with your landing party on");
234 prout("a wild jungle planet inhabited by primitive cannibals.");
236 prout("They are very fond of \"Captain Kirk\" soup.");
238 proutn("Without your leadership, the ");
240 prout(" is destroyed.");
243 prout("You and your mining party perish.");
245 prout("That was a great shot.");
249 prout("The Galileo is instantly annihilated by the supernova.");
252 prout("You and your mining party are atomized.");
254 proutn("Mr. Spock takes command of the ");
257 prout("joins the Romulans, reigning terror on the Federation.");
260 prout("The shuttle craft Galileo is also caught,");
261 prout("and breaks up under the strain.");
263 prout("Your debris is scattered for millions of miles.");
264 proutn("Without your leadership, the ");
266 prout(" is destroyed.");
269 prout("The mutants attack and kill Spock.");
270 prout("Your ship is captured by Klingons, and");
271 prout("your crew is put on display in a Klingon zoo.");
274 prout("Tribbles consume all remaining water,");
275 prout("food, and oxygen on your ship.");
277 prout("You die of thirst, starvation, and asphyxiation.");
278 prout("Your starship is a derelict in space.");
281 prout("Your ship is drawn to the center of the black hole.");
282 prout("You are crushed into extremely dense matter.");
285 if (ship==IHF) ship= 0;
286 else if (ship == IHE) ship = IHF;
289 double goodies = game.state.remres/inresor;
290 double baddies = (game.state.remkl + 2.0*game.state.remcom)/(inkling+2.0*incom);
291 if (goodies/baddies >= 1.0+0.5*Rand()) {
292 prout("As a result of your actions, a treaty with the Klingon");
293 prout("Empire has been signed. The terms of the treaty are");
294 if (goodies/baddies >= 3.0+Rand()) {
295 prout("favorable to the Federation.");
297 prout("Congratulations!");
300 prout("highly unfavorable to the Federation.");
303 prout("The Federation will be destroyed.");
306 prout("Since you took the last Klingon with you, you are a");
307 prout("martyr and a hero. Someday maybe they'll erect a");
308 prout("statue in your memory. Rest in peace, and try not");
309 prout("to think about pigeons.");
317 double timused = game.state.date - indate;
318 int ithperd, iwon, klship;
321 if ((timused == 0 || KLINGREM != 0) && timused < 5.0) timused = 5.0;
322 perdate = KLINGKILLED/timused;
323 ithperd = 500*perdate + 0.5;
325 if (gamewon) iwon = 100*skill;
326 if (ship == IHE) klship = 0;
327 else if (ship == IHF) klship = 1;
329 if (gamewon == 0) game.state.nromrem = 0; // None captured if no win
330 iscore = 10*NKILLK + 50*NKILLC + ithperd + iwon
331 - 100*game.state.basekl - 100*klship - 45*nhelp -5*game.state.starkl - casual
332 + 20*NKILLROM + 200*NKILLSC - 10*game.state.nplankl + game.state.nromrem;
333 if (alive == 0) iscore -= 200;
335 prout("Your score --");
337 prout("%6d Romulans destroyed %5d",
338 NKILLROM,20*NKILLROM);
339 if (game.state.nromrem)
340 prout("%6d Romulans captured %5d",
341 game.state.nromrem, game.state.nromrem);
343 prout("%6d ordinary Klingons destroyed %5d",
346 prout("%6d Klingon commanders destroyed %5d",
349 prout("%6d Super-Commander destroyed %5d",
350 NKILLSC, 200*NKILLSC);
352 prout("%6.2f Klingons per stardate %5d",
354 if (game.state.starkl)
355 prout("%6d stars destroyed by your action %5d",
356 game.state.starkl, -5*game.state.starkl);
357 if (game.state.nplankl)
358 prout("%6d planets destroyed by your action %5d",
359 game.state.nplankl, -10*game.state.nplankl);
360 if (game.state.basekl)
361 prout("%6d bases destroyed by your action %5d",
362 game.state.basekl, -100*game.state.basekl);
364 prout("%6d calls for help from starbase %5d",
367 prout("%6d casualties incurred %5d",
370 prout("%6d ship(s) lost or destroyed %5d",
371 klship, -100*klship);
373 prout("Penalty for getting yourself killed -200");
375 proutn("Bonus for winning ");
377 case SKILL_NOVICE: proutn("Novice game "); break;
378 case SKILL_FAIR: proutn("Fair game "); break;
379 case SKILL_GOOD: proutn("Good game "); break;
380 case SKILL_EXPERT: proutn("Expert game "); break;
381 case SKILL_EMERITUS: proutn("Emeritus game"); break;
386 prout("TOTAL SCORE %5d", iscore);
399 proutn("File or device name for your plaque: ");
400 cgetline(winner, sizeof(winner));
401 fp = fopen(winner, "w");
403 prout("Invalid name.");
407 proutn("Enter name to go on plaque (up to 30 characters): ");
408 cgetline(winner, sizeof(winner));
409 /* The 38 below must be 64 for 132-column paper */
410 nskip = 38 - strlen(winner)/2;
412 fprintf(fp,"\n\n\n\n");
413 /* --------DRAW ENTERPRISE PICTURE. */
414 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n" );
415 fprintf(fp, " EEE E : : : E\n" );
416 fprintf(fp, " EE EEE E : : NCC-1701 : E\n");
417 fprintf(fp, "EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEE : : : E\n");
418 fprintf(fp, " E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n");
419 fprintf(fp, " EEEEEEEEE EEEEEEEEEEEEE E E\n");
420 fprintf(fp, " EEEEEEE EEEEE E E E E\n");
421 fprintf(fp, " EEE E E E E\n");
422 fprintf(fp, " E E E E\n");
423 fprintf(fp, " EEEEEEEEEEEEE E E\n");
424 fprintf(fp, " EEE : EEEEEEE EEEEEEEE\n");
425 fprintf(fp, " :E : EEEE E\n");
426 fprintf(fp, " .-E -:----- E\n");
427 fprintf(fp, " :E : E\n");
428 fprintf(fp, " EE : EEEEEEEE\n");
429 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEE\n");
430 fprintf(fp, "\n\n\n");
431 fprintf(fp, " U. S. S. ENTERPRISE\n");
432 fprintf(fp, "\n\n\n\n");
433 fprintf(fp, " For demonstrating outstanding ability as a starship captain\n");
435 fprintf(fp, " Starfleet Command bestows to you\n");
437 fprintf(fp,"%*s%s\n\n", nskip, "", winner);
438 fprintf(fp, " the rank of\n\n");
439 fprintf(fp, " \"Commodore Emeritus\"\n\n");
442 case SKILL_EXPERT: fprintf(fp," Expert level\n\n"); break;
443 case SKILL_EMERITUS: fprintf(fp,"Emeritus level\n\n"); break;
444 default: fprintf(fp," Cheat level\n\n"); break;
447 timestring = ctime(&t);
448 fprintf(fp, " This day of %.6s %.4s, %.8s\n\n",
449 timestring+4, timestring+20, timestring+11);
450 fprintf(fp," Your score: %d\n\n", iscore);
451 fprintf(fp," Klingons per stardate: %.2f\n", perdate);