6 /* Finish with a BANG! */
8 if (game.damage[DCOMPTR] != 0.0) {
9 prout("Computer damaged; cannot execute destruct sequence.");
13 prouts("---WORKING---"); skip(1);
14 prout("SELF-DESTRUCT-SEQUENCE-ACTIVATED");
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);
20 prout("ENTER-CORRECT-PASSWORD-TO-CONTINUE-");
21 prout("SELF-DESTRUCT-SEQUENCE-OTHERWISE-");
22 prout("SELF-DESTRUCT-SEQUENCE-WILL-BE-ABORTED");
25 if (strcmp(game.passwd, citem) != 0) {
26 prouts("PASSWORD-REJECTED;"); skip(1);
27 prout("CONTINUITY-EFFECTED");
31 prouts("PASSWORD-ACCEPTED"); skip(1);
32 prouts(" 5"); skip(1);
33 prouts(" 4"); skip(1);
34 prouts(" 3"); skip(1);
35 prouts(" 2"); skip(1);
36 prouts(" 1"); skip(1);
38 prouts("GOODBYE-CRUEL-WORLD");
47 if (ship==IHE) prouts("***");
48 prouts("********* Entropy of ");
50 prouts(" maximized *********");
55 double whammo = 25.0 * energy;
57 while (l <= nenhere) {
58 if (game.kpower[l]*game.kdist[l] <= whammo)
59 deadkl(game.kx[l],game.ky[l], game.quad[game.kx[l]][game.ky[l]], game.kx[l], game.ky[l]);
67 void finish(FINTYPE ifin) {
71 prout("It is stardate %.1f.", game.state.date);
74 case FWON: // Game has been won
75 if (game.state.nromrem != 0)
76 prout("The remaining %d Romulans surrender to Starfleet Command.",
79 prout("You have smashed the Klingon invasion fleet and saved");
80 prout("the Federation.");
84 badpt = 5.*game.state.starkl + casual + 10.*game.state.nplankl +
85 45.*nhelp+100.*game.state.basekl;
86 if (ship == IHF) badpt += 100.0;
87 else if (ship == 0) badpt += 200.0;
88 if (badpt < 100.0) badpt = 0.0; // Close enough!
89 if (game.state.date-indate < 5.0 ||
90 // killsPerDate >= RateMax
91 (game.state.killk+game.state.killc+game.state.nsckill)/(game.state.date-indate) >=
92 0.1*skill*(skill+1.0) + 0.1 + 0.008*badpt) {
94 prout("In fact, you have done so well that Starfleet Command");
97 prout("promotes you one step in rank from \"Novice\" to \"Fair\".");
100 prout("promotes you one step in rank from \"Fair\" to \"Good\".");
103 prout("promotes you one step in rank from \"Good\" to \"Expert\".");
106 prout("promotes you to Commodore Emeritus.");
108 prout("Now that you think you're really good, try playing");
109 prout("the \"Emeritus\" game. It will splatter your ego.");
113 prout("Computer- ERROR-ERROR-ERROR-ERROR");
115 prout(" YOUR-SKILL-HAS-EXCEEDED-THE-CAPACITY-OF-THIS-PROGRAM");
116 prout(" THIS-PROGRAM-MUST-SURVIVE");
117 prout(" THIS-PROGRAM-MUST-SURVIVE");
118 prout(" THIS-PROGRAM-MUST-SURVIVE");
119 prout(" THIS-PROGRAM-MUST?- MUST ? - SUR? ? -? VI");
121 prout("Now you can retire and write your own Star Trek game!");
131 prout("You cannot get a citation, so...");
133 prout("Do you want your Commodore Emeritus Citation printed?");
134 proutn("(You need a 132 column printer.)");
142 // Only grant long life if alive (original didn't!)
144 prout("LIVE LONG AND PROSPER.");
147 if (igotit != 0) plaque();
149 case FDEPLETE: // Federation Resources Depleted
150 prout("Your time has run out and the Federation has been");
151 prout("conquered. Your starship is now Klingon property,");
152 prout("and you are put on trial as a war criminal. On the");
153 proutn("basis of your record, you are ");
154 if (game.state.remkl*3.0 > inkling) {
157 prout("LIVE LONG AND PROSPER.");
160 prout("found guilty and");
161 prout("sentenced to death by slow torture.");
167 prout("Your life support reserves have run out, and");
168 prout("you die of thirst, starvation, and asphyxiation.");
169 prout("Your starship is a derelict in space.");
172 prout("Your energy supply is exhausted.");
174 prout("Your starship is a derelict in space.");
179 prout("has been destroyed in battle.");
181 prout("Dulce et decorum est pro patria mori.");
184 prout("You have made three attempts to cross the negative energy");
185 prout("barrier which surrounds the galaxy.");
187 prout("Your navigation is abominable.");
191 prout("Your starship has been destroyed by a nova.");
192 prout("That was a great shot.");
198 prout(" has been fried by a supernova.");
199 prout("...Not even cinders remain...");
202 prout("You have been captured by the Klingons. If you still");
203 prout("had a starbase to be returned to, you would have been");
204 prout("repatriated and given another chance. Since you have");
205 prout("no starbases, you will be mercilessly tortured to death.");
208 prout("Your starship is now an expanding cloud of subatomic particles");
211 prout("Starbase was unable to re-materialize your starship.");
212 prout("Sic transit gloria muntdi");
217 prout(" has been cremated by its own phasers.");
220 prout("You and your landing party have been");
221 prout("converted to energy, disipating through space.");
224 prout("You are left with your landing party on");
225 prout("a wild jungle planet inhabited by primitive cannibals.");
227 prout("They are very fond of \"Captain Kirk\" soup.");
229 proutn("Without your leadership, the ");
231 prout(" is destroyed.");
234 prout("You and your mining party perish.");
236 prout("That was a great shot.");
240 prout("The Galileo is instantly annihilated by the supernova.");
243 prout("You and your mining party are atomized.");
245 proutn("Mr. Spock takes command of the ");
248 prout("joins the Romulans, reigning terror on the Federation.");
251 prout("The shuttle craft Galileo is also caught,");
252 prout("and breaks up under the strain.");
254 prout("Your debris is scattered for millions of miles.");
255 proutn("Without your leadership, the ");
257 prout(" is destroyed.");
260 prout("The mutants attack and kill Spock.");
261 prout("Your ship is captured by Klingons, and");
262 prout("your crew is put on display in a Klingon zoo.");
265 prout("Tribbles consume all remaining water,");
266 prout("food, and oxygen on your ship.");
268 prout("You die of thirst, starvation, and asphyxiation.");
269 prout("Your starship is a derelict in space.");
272 prout("Your ship is drawn to the center of the black hole.");
273 prout("You are crushed into extremely dense matter.");
276 if (ship==IHF) ship= 0;
277 else if (ship == IHE) ship = IHF;
279 if (game.state.remkl != 0) {
280 double goodies = game.state.remres/inresor;
281 double baddies = (game.state.remkl + 2.0*game.state.remcom)/(inkling+2.0*incom);
282 if (goodies/baddies >= 1.0+0.5*Rand()) {
283 prout("As a result of your actions, a treaty with the Klingon");
284 prout("Empire has been signed. The terms of the treaty are");
285 if (goodies/baddies >= 3.0+Rand()) {
286 prout("favorable to the Federation.");
288 prout("Congratulations!");
291 prout("highly unfavorable to the Federation.");
294 prout("The Federation will be destroyed.");
297 prout("Since you took the last Klingon with you, you are a");
298 prout("martyr and a hero. Someday maybe they'll erect a");
299 prout("statue in your memory. Rest in peace, and try not");
300 prout("to think about pigeons.");
307 double timused = game.state.date - indate;
308 int ithperd, iwon, klship;
313 if ((timused == 0 || game.state.remkl != 0) && timused < 5.0) timused = 5.0;
314 perdate = (game.state.killc + game.state.killk + game.state.nsckill)/timused;
315 ithperd = 500*perdate + 0.5;
317 if (gamewon) iwon = 100*skill;
318 if (ship == IHE) klship = 0;
319 else if (ship == IHF) klship = 1;
321 if (gamewon == 0) game.state.nromrem = 0; // None captured if no win
322 iscore = 10*game.state.killk + 50*game.state.killc + ithperd + iwon
323 - 100*game.state.basekl - 100*klship - 45*nhelp -5*game.state.starkl - casual
324 + 20*game.state.nromkl + 200*game.state.nsckill - 10*game.state.nplankl + game.state.nromrem;
325 if (alive == 0) iscore -= 200;
327 prout("Your score --");
328 if (game.state.nromkl)
329 prout("%6d Romulans destroyed %5d",
330 game.state.nromkl,20*game.state.nromkl);
331 if (game.state.nromrem)
332 prout("%6d Romulans captured %5d",
333 game.state.nromrem, game.state.nromrem);
334 if (game.state.killk)
335 prout("%6d ordinary Klingons destroyed %5d",
336 game.state.killk, 10*game.state.killk);
337 if (game.state.killc)
338 prout("%6d Klingon commanders destroyed %5d",
339 game.state.killc, 50*game.state.killc);
340 if (game.state.nsckill)
341 prout("%6d Super-Commander destroyed %5d",
342 game.state.nsckill, 200*game.state.nsckill);
344 prout("%.2f Klingons per stardate %5d",
346 if (game.state.starkl)
347 prout("%6d stars destroyed by your action %5d",
348 game.state.starkl, -5*game.state.starkl);
349 if (game.state.nplankl)
350 prout("%6d planets destroyed by your action %5d",
351 game.state.nplankl, -10*game.state.nplankl);
352 if (game.state.basekl)
353 prout("%6d bases destroyed by your action %5d",
354 game.state.basekl, -100*game.state.basekl);
356 prout("%6d calls for help from starbase %5d",
359 prout("%6d casualties incurred %5d",
362 prout("%6d ship(s) lost or destroyed %5d",
363 klship, -100*klship);
365 prout("Penalty for getting yourself killed -200");
368 proutn("Bonus for winning ");
370 case 1: proutn("Novice game "); break;
371 case 2: proutn("Fair game "); break;
372 case 3: proutn("Good game "); break;
373 case 4: proutn("Expert game "); break;
374 case 5: proutn("Emeritus game"); break;
379 prout("TOTAL SCORE %5d", iscore);
392 proutn("File or device name for your plaque:");
393 fgets(winner, 128, stdin);
394 winner[strlen(winner)-1] = '\0';
395 fp = fopen(winner, "w");
397 prout("Invalid name.");
401 proutn("Enter name to go on plaque (up to 30 characters):");
402 fgets(winner, 128, stdin);
403 winner[strlen(winner)-1] = '\0';
405 nskip = 64 - strlen(winner)/2;
407 fprintf(fp,"\n\n\n\n");
408 /* --------DRAW ENTERPRISE PICTURE. */
409 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n" );
410 fprintf(fp, " EEE E : : : E\n" );
411 fprintf(fp, " EE EEE E : : NCC-1701 : E\n");
412 fprintf(fp, " EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEE E : : : E\n");
413 fprintf(fp, " E E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n");
414 fprintf(fp, " EEEEEEEEE EEEEEEEEEEEEE E E\n");
415 fprintf(fp, " EEEEEEE EEEEE E E E E\n");
416 fprintf(fp, " EEE E E E E\n");
417 fprintf(fp, " E E E E\n");
418 fprintf(fp, " EEEEEEEEEEEEE E E\n");
419 fprintf(fp, " EEE : EEEEEEE EEEEEEEE\n");
420 fprintf(fp, " :E : EEEE E\n");
421 fprintf(fp, " .-E -:----- E\n");
422 fprintf(fp, " :E : E\n");
423 fprintf(fp, " EE : EEEEEEEE\n");
424 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEE\n");
425 fprintf(fp, "\n\n\n");
426 fprintf(fp, " U. S. S. ENTERPRISE\n");
427 fprintf(fp, "\n\n\n\n");
428 fprintf(fp, " For demonstrating outstanding ability as a starship captain\n");
430 fprintf(fp, " Starfleet Command bestows to you\n");
432 fprintf(fp,"%*s%s\n\n", nskip, "", winner);
433 fprintf(fp, " the rank of\n\n");
434 fprintf(fp, " \"Commodore Emeritus\"\n\n");
437 case 4: fprintf(fp," Expert level\n\n"); break;
438 case 5: fprintf(fp,"Emeritus level\n\n"); break;
439 default: fprintf(fp," Cheat level\n\n"); break;
442 timestring = ctime(&t);
443 fprintf(fp, " This day of %.6s %.4s, %.8s\n\n",
444 timestring+4, timestring+20, timestring+11);
445 fprintf(fp," Your score: %d\n\n", iscore);
446 fprintf(fp," Klingons per stardate: %.2f\n", perdate);