6 /* Finish with a BANG! */
8 if (game.damage[DCOMPTR] != 0.0) {
9 prout("Computer damaged; cannot execute destruct sequence.");
12 prouts("---WORKING---"); skip(1);
13 prouts("SELF-DESTRUCT-SEQUENCE-ACTIVATED"); skip(1);
14 prouts(" 10"); skip(1);
15 prouts(" 9"); skip(1);
16 prouts(" 8"); skip(1);
17 prouts(" 7"); skip(1);
18 prouts(" 6"); skip(1);
20 prout("ENTER-CORRECT-PASSWORD-TO-CONTINUE-");
22 prout("SELF-DESTRUCT-SEQUENCE-OTHERWISE-");
24 prout("SELF-DESTRUCT-SEQUENCE-WILL-BE-ABORTED");
28 if (strcmp(game.passwd, citem) != 0) {
29 prouts("PASSWORD-REJECTED;"); skip(1);
30 prouts("CONTINUITY-EFFECTED");
34 prouts("PASSWORD-ACCEPTED"); skip(1);
35 prouts(" 5"); skip(1);
36 prouts(" 4"); skip(1);
37 prouts(" 3"); skip(1);
38 prouts(" 2"); skip(1);
39 prouts(" 1"); skip(1);
41 prouts("GOODBYE-CRUEL-WORLD");
49 if (ship==IHE) prouts("***");
50 prouts("********* Entropy of ");
52 prouts(" maximized *********");
57 double whammo = 25.0 * energy;
59 while (l <= nenhere) {
60 if (game.kpower[l]*game.kdist[l] <= whammo)
61 deadkl(game.kx[l],game.ky[l], game.quad[game.kx[l]][game.ky[l]], game.kx[l], game.ky[l]);
69 void finish(FINTYPE ifin) {
73 prout("It is stardate %.1f.", game.state.date);
76 case FWON: // Game has been won
77 if (game.state.nromrem != 0)
78 prout("The remaining %d Romulans surrender to Starfleet Command.",
81 prout("You have smashed the Klingon invasion fleet and saved");
82 prout("the Federation.");
86 badpt = 5.*game.state.starkl + casual + 10.*game.state.nplankl +
87 45.*nhelp+100.*game.state.basekl;
88 if (ship == IHF) badpt += 100.0;
89 else if (ship == 0) badpt += 200.0;
90 if (badpt < 100.0) badpt = 0.0; // Close enough!
91 if (game.state.date-indate < 5.0 ||
92 // killsPerDate >= RateMax
93 (game.state.killk+game.state.killc+game.state.nsckill)/(game.state.date-indate) >=
94 0.1*skill*(skill+1.0) + 0.1 + 0.008*badpt) {
96 prout("In fact, you have done so well that Starfleet Command");
99 prout("promotes you one step in rank from \"Novice\" to \"Fair\".");
102 prout("promotes you one step in rank from \"Fair\" to \"Good\".");
105 prout("promotes you one step in rank from \"Good\" to \"Expert\".");
108 prout("promotes you to Commodore Emeritus.");
110 prout("Now that you think you're really good, try playing");
111 prout("the \"Emeritus\" game. It will splatter your ego.");
115 proutn("Computer- ");
116 prouts("ERROR-ERROR-ERROR-ERROR");
118 prouts(" YOUR-SKILL-HAS-EXCEEDED-THE-CAPACITY-OF-THIS-PROGRAM");
120 prouts(" THIS-PROGRAM-MUST-SURVIVE");
122 prouts(" THIS-PROGRAM-MUST-SURVIVE");
124 prouts(" THIS-PROGRAM-MUST-SURVIVE");
126 prouts(" THIS-PROGRAM-MUST?- MUST ? - SUR? ? -? VI");
128 prout("Now you can retire and write your own Star Trek game!");
138 prout("You cannot get a citation, so...");
140 proutn("Do you want your Commodore Emeritus Citation printed? ");
148 // Only grant long life if alive (original didn't!)
150 prout("LIVE LONG AND PROSPER.");
153 if (igotit != 0) plaque();
155 case FDEPLETE: // Federation Resources Depleted
156 prout("Your time has run out and the Federation has been");
157 prout("conquered. Your starship is now Klingon property,");
158 prout("and you are put on trial as a war criminal. On the");
159 proutn("basis of your record, you are ");
160 if (game.state.remkl*3.0 > inkling) {
163 prout("LIVE LONG AND PROSPER.");
166 prout("found guilty and");
167 prout("sentenced to death by slow torture.");
173 prout("Your life support reserves have run out, and");
174 prout("you die of thirst, starvation, and asphyxiation.");
175 prout("Your starship is a derelict in space.");
178 prout("Your energy supply is exhausted.");
180 prout("Your starship is a derelict in space.");
185 prout("has been destroyed in battle.");
187 prout("Dulce et decorum est pro patria mori.");
190 prout("You have made three attempts to cross the negative energy");
191 prout("barrier which surrounds the galaxy.");
193 prout("Your navigation is abominable.");
197 prout("Your starship has been destroyed by a nova.");
198 prout("That was a great shot.");
204 prout(" has been fried by a supernova.");
205 prout("...Not even cinders remain...");
208 prout("You have been captured by the Klingons. If you still");
209 prout("had a starbase to be returned to, you would have been");
210 prout("repatriated and given another chance. Since you have");
211 prout("no starbases, you will be mercilessly tortured to death.");
214 prout("Your starship is now an expanding cloud of subatomic particles");
217 prout("Starbase was unable to re-materialize your starship.");
218 prout("Sic transit gloria muntdi");
223 prout(" has been cremated by its own phasers.");
226 prout("You and your landing party have been");
227 prout("converted to energy, disipating through space.");
230 prout("You are left with your landing party on");
231 prout("a wild jungle planet inhabited by primitive cannibals.");
233 prout("They are very fond of \"Captain Kirk\" soup.");
235 proutn("Without your leadership, the ");
237 prout(" is destroyed.");
240 prout("You and your mining party perish.");
242 prout("That was a great shot.");
246 prout("The Galileo is instantly annihilated by the supernova.");
249 prout("You and your mining party are atomized.");
251 proutn("Mr. Spock takes command of the ");
254 prout("joins the Romulans, reigning terror on the Federation.");
257 prout("The shuttle craft Galileo is also caught,");
258 prout("and breaks up under the strain.");
260 prout("Your debris is scattered for millions of miles.");
261 proutn("Without your leadership, the ");
263 prout(" is destroyed.");
266 prout("The mutants attack and kill Spock.");
267 prout("Your ship is captured by Klingons, and");
268 prout("your crew is put on display in a Klingon zoo.");
271 prout("Tribbles consume all remaining water,");
272 prout("food, and oxygen on your ship.");
274 prout("You die of thirst, starvation, and asphyxiation.");
275 prout("Your starship is a derelict in space.");
278 prout("Your ship is drawn to the center of the black hole.");
279 prout("You are crushed into extremely dense matter.");
282 if (ship==IHF) ship= 0;
283 else if (ship == IHE) ship = IHF;
285 if (game.state.remkl != 0) {
286 double goodies = game.state.remres/inresor;
287 double baddies = (game.state.remkl + 2.0*game.state.remcom)/(inkling+2.0*incom);
288 if (goodies/baddies >= 1.0+0.5*Rand()) {
289 prout("As a result of your actions, a treaty with the Klingon");
290 prout("Empire has been signed. The terms of the treaty are");
291 if (goodies/baddies >= 3.0+Rand()) {
292 prout("favorable to the Federation.");
294 prout("Congratulations!");
297 prout("highly unfavorable to the Federation.");
300 prout("The Federation will be destroyed.");
303 prout("Since you took the last Klingon with you, you are a");
304 prout("martyr and a hero. Someday maybe they'll erect a");
305 prout("statue in your memory. Rest in peace, and try not");
306 prout("to think about pigeons.");
313 double timused = game.state.date - indate;
314 int ithperd, iwon, klship;
317 if ((timused == 0 || game.state.remkl != 0) && timused < 5.0) timused = 5.0;
318 perdate = (game.state.killc + game.state.killk + game.state.nsckill)/timused;
319 ithperd = 500*perdate + 0.5;
321 if (gamewon) iwon = 100*skill;
322 if (ship == IHE) klship = 0;
323 else if (ship == IHF) klship = 1;
325 if (gamewon == 0) game.state.nromrem = 0; // None captured if no win
326 iscore = 10*game.state.killk + 50*game.state.killc + ithperd + iwon
327 - 100*game.state.basekl - 100*klship - 45*nhelp -5*game.state.starkl - casual
328 + 20*game.state.nromkl + 200*game.state.nsckill - 10*game.state.nplankl + game.state.nromrem;
329 if (alive == 0) iscore -= 200;
331 prout("Your score --");
332 if (game.state.nromkl)
333 prout("%6d Romulans destroyed %5d",
334 game.state.nromkl,20*game.state.nromkl);
335 if (game.state.nromrem)
336 prout("%6d Romulans captured %5d",
337 game.state.nromrem, game.state.nromrem);
338 if (game.state.killk)
339 prout("%6d ordinary Klingons destroyed %5d",
340 game.state.killk, 10*game.state.killk);
341 if (game.state.killc)
342 prout("%6d Klingon commanders destroyed %5d",
343 game.state.killc, 50*game.state.killc);
344 if (game.state.nsckill)
345 prout("%6d Super-Commander destroyed %5d",
346 game.state.nsckill, 200*game.state.nsckill);
348 prout("%6.2f Klingons per stardate %5d",
350 if (game.state.starkl)
351 prout("%6d stars destroyed by your action %5d",
352 game.state.starkl, -5*game.state.starkl);
353 if (game.state.nplankl)
354 prout("%6d planets destroyed by your action %5d",
355 game.state.nplankl, -10*game.state.nplankl);
356 if (game.state.basekl)
357 prout("%6d bases destroyed by your action %5d",
358 game.state.basekl, -100*game.state.basekl);
360 prout("%6d calls for help from starbase %5d",
363 prout("%6d casualties incurred %5d",
366 prout("%6d ship(s) lost or destroyed %5d",
367 klship, -100*klship);
369 prout("Penalty for getting yourself killed -200");
371 proutn("Bonus for winning ");
373 case 1: proutn("Novice game "); break;
374 case 2: proutn("Fair game "); break;
375 case 3: proutn("Good game "); break;
376 case 4: proutn("Expert game "); break;
377 case 5: proutn("Emeritus game"); break;
382 prout("TOTAL SCORE %5d", iscore);
395 proutn("File or device name for your plaque: ");
396 getline(winner, sizeof(winner));
397 fp = fopen(winner, "w");
399 prout("Invalid name.");
403 proutn("Enter name to go on plaque (up to 30 characters): ");
404 getline(winner, sizeof(winner));
405 /* The 38 below must be 64 for 132-column paper */
406 nskip = 38 - strlen(winner)/2;
408 fprintf(fp,"\n\n\n\n");
409 /* --------DRAW ENTERPRISE PICTURE. */
410 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n" );
411 fprintf(fp, " EEE E : : : E\n" );
412 fprintf(fp, " EE EEE E : : NCC-1701 : E\n");
413 fprintf(fp, "EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEE : : : E\n");
414 fprintf(fp, " E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n");
415 fprintf(fp, " EEEEEEEEE EEEEEEEEEEEEE E E\n");
416 fprintf(fp, " EEEEEEE EEEEE E E E E\n");
417 fprintf(fp, " EEE E E E E\n");
418 fprintf(fp, " E E E E\n");
419 fprintf(fp, " EEEEEEEEEEEEE E E\n");
420 fprintf(fp, " EEE : EEEEEEE EEEEEEEE\n");
421 fprintf(fp, " :E : EEEE E\n");
422 fprintf(fp, " .-E -:----- E\n");
423 fprintf(fp, " :E : E\n");
424 fprintf(fp, " EE : EEEEEEEE\n");
425 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEE\n");
426 fprintf(fp, "\n\n\n");
427 fprintf(fp, " U. S. S. ENTERPRISE\n");
428 fprintf(fp, "\n\n\n\n");
429 fprintf(fp, " For demonstrating outstanding ability as a starship captain\n");
431 fprintf(fp, " Starfleet Command bestows to you\n");
433 fprintf(fp,"%*s%s\n\n", nskip, "", winner);
434 fprintf(fp, " the rank of\n\n");
435 fprintf(fp, " \"Commodore Emeritus\"\n\n");
438 case 4: fprintf(fp," Expert level\n\n"); break;
439 case 5: fprintf(fp,"Emeritus level\n\n"); break;
440 default: fprintf(fp," Cheat level\n\n"); break;
443 timestring = ctime(&t);
444 fprintf(fp, " This day of %.6s %.4s, %.8s\n\n",
445 timestring+4, timestring+20, timestring+11);
446 fprintf(fp," Your score: %d\n\n", iscore);
447 fprintf(fp," Klingons per stardate: %.2f\n", perdate);