9 /* Finish with a BANG! */
11 if (game.damage[DCOMPTR] != 0.0) {
12 prout("Computer damaged; cannot execute destruct sequence.");
15 prouts("---WORKING---"); skip(1);
16 prouts("SELF-DESTRUCT-SEQUENCE-ACTIVATED"); skip(1);
17 prouts(" 10"); skip(1);
18 prouts(" 9"); skip(1);
19 prouts(" 8"); skip(1);
20 prouts(" 7"); skip(1);
21 prouts(" 6"); skip(1);
25 prout("ENTER-CORRECT-PASSWORD-TO-CONTINUE-");
29 prout("SELF-DESTRUCT-SEQUENCE-OTHERWISE-");
33 prout("SELF-DESTRUCT-SEQUENCE-WILL-BE-ABORTED");
39 if (strcmp(game.passwd, citem) != 0) {
40 prouts("PASSWORD-REJECTED;"); skip(1);
41 prouts("CONTINUITY-EFFECTED");
45 prouts("PASSWORD-ACCEPTED"); skip(1);
46 prouts(" 5"); skip(1);
47 prouts(" 4"); skip(1);
48 prouts(" 3"); skip(1);
49 prouts(" 2"); skip(1);
50 prouts(" 1"); skip(1);
52 prouts("GOODBYE-CRUEL-WORLD");
60 if (ship==IHE) prouts("***");
61 prouts("********* Entropy of ");
63 prouts(" maximized *********");
68 double whammo = 25.0 * energy;
70 while (l <= nenhere) {
71 if (game.kpower[l]*game.kdist[l] <= whammo)
72 deadkl(game.kx[l],game.ky[l], game.quad[game.kx[l]][game.ky[l]], game.kx[l], game.ky[l]);
80 void finish(FINTYPE ifin) {
84 prout("It is stardate %.1f.", game.state.date);
87 case FWON: // Game has been won
88 if (game.state.nromrem != 0)
89 prout("The remaining %d Romulans surrender to Starfleet Command.",
92 prout("You have smashed the Klingon invasion fleet and saved");
93 prout("the Federation.");
97 badpt = 5.*game.state.starkl + casual + 10.*game.state.nplankl +
98 45.*nhelp+100.*game.state.basekl;
99 if (ship == IHF) badpt += 100.0;
100 else if (ship == 0) badpt += 200.0;
101 if (badpt < 100.0) badpt = 0.0; // Close enough!
102 if (game.state.date-indate < 5.0 ||
103 // killsPerDate >= RateMax
104 (game.state.killk+game.state.killc+game.state.nsckill)/(game.state.date-indate) >=
105 0.1*skill*(skill+1.0) + 0.1 + 0.008*badpt) {
107 prout("In fact, you have done so well that Starfleet Command");
110 prout("promotes you one step in rank from \"Novice\" to \"Fair\".");
113 prout("promotes you one step in rank from \"Fair\" to \"Good\".");
116 prout("promotes you one step in rank from \"Good\" to \"Expert\".");
119 prout("promotes you to Commodore Emeritus.");
121 prout("Now that you think you're really good, try playing");
122 prout("the \"Emeritus\" game. It will splatter your ego.");
126 proutn("Computer- ");
127 prouts("ERROR-ERROR-ERROR-ERROR");
129 prouts(" YOUR-SKILL-HAS-EXCEEDED-THE-CAPACITY-OF-THIS-PROGRAM");
131 prouts(" THIS-PROGRAM-MUST-SURVIVE");
133 prouts(" THIS-PROGRAM-MUST-SURVIVE");
135 prouts(" THIS-PROGRAM-MUST-SURVIVE");
137 prouts(" THIS-PROGRAM-MUST?- MUST ? - SUR? ? -? VI");
139 prout("Now you can retire and write your own Star Trek game!");
149 prout("You cannot get a citation, so...");
151 proutn("Do you want your Commodore Emeritus Citation printed? ");
159 // Only grant long life if alive (original didn't!)
161 prout("LIVE LONG AND PROSPER.");
164 if (igotit != 0) plaque();
166 case FDEPLETE: // Federation Resources Depleted
167 prout("Your time has run out and the Federation has been");
168 prout("conquered. Your starship is now Klingon property,");
169 prout("and you are put on trial as a war criminal. On the");
170 proutn("basis of your record, you are ");
171 if (game.state.remkl*3.0 > inkling) {
174 prout("LIVE LONG AND PROSPER.");
177 prout("found guilty and");
178 prout("sentenced to death by slow torture.");
184 prout("Your life support reserves have run out, and");
185 prout("you die of thirst, starvation, and asphyxiation.");
186 prout("Your starship is a derelict in space.");
189 prout("Your energy supply is exhausted.");
191 prout("Your starship is a derelict in space.");
196 prout("has been destroyed in battle.");
198 prout("Dulce et decorum est pro patria mori.");
201 prout("You have made three attempts to cross the negative energy");
202 prout("barrier which surrounds the galaxy.");
204 prout("Your navigation is abominable.");
208 prout("Your starship has been destroyed by a nova.");
209 prout("That was a great shot.");
215 prout(" has been fried by a supernova.");
216 prout("...Not even cinders remain...");
219 prout("You have been captured by the Klingons. If you still");
220 prout("had a starbase to be returned to, you would have been");
221 prout("repatriated and given another chance. Since you have");
222 prout("no starbases, you will be mercilessly tortured to death.");
225 prout("Your starship is now an expanding cloud of subatomic particles");
228 prout("Starbase was unable to re-materialize your starship.");
229 prout("Sic transit gloria muntdi");
234 prout(" has been cremated by its own phasers.");
237 prout("You and your landing party have been");
238 prout("converted to energy, disipating through space.");
241 prout("You are left with your landing party on");
242 prout("a wild jungle planet inhabited by primitive cannibals.");
244 prout("They are very fond of \"Captain Kirk\" soup.");
246 proutn("Without your leadership, the ");
248 prout(" is destroyed.");
251 prout("You and your mining party perish.");
253 prout("That was a great shot.");
257 prout("The Galileo is instantly annihilated by the supernova.");
260 prout("You and your mining party are atomized.");
262 proutn("Mr. Spock takes command of the ");
265 prout("joins the Romulans, reigning terror on the Federation.");
268 prout("The shuttle craft Galileo is also caught,");
269 prout("and breaks up under the strain.");
271 prout("Your debris is scattered for millions of miles.");
272 proutn("Without your leadership, the ");
274 prout(" is destroyed.");
277 prout("The mutants attack and kill Spock.");
278 prout("Your ship is captured by Klingons, and");
279 prout("your crew is put on display in a Klingon zoo.");
282 prout("Tribbles consume all remaining water,");
283 prout("food, and oxygen on your ship.");
285 prout("You die of thirst, starvation, and asphyxiation.");
286 prout("Your starship is a derelict in space.");
289 prout("Your ship is drawn to the center of the black hole.");
290 prout("You are crushed into extremely dense matter.");
293 if (ship==IHF) ship= 0;
294 else if (ship == IHE) ship = IHF;
296 if (game.state.remkl != 0) {
297 double goodies = game.state.remres/inresor;
298 double baddies = (game.state.remkl + 2.0*game.state.remcom)/(inkling+2.0*incom);
299 if (goodies/baddies >= 1.0+0.5*Rand()) {
300 prout("As a result of your actions, a treaty with the Klingon");
301 prout("Empire has been signed. The terms of the treaty are");
302 if (goodies/baddies >= 3.0+Rand()) {
303 prout("favorable to the Federation.");
305 prout("Congratulations!");
308 prout("highly unfavorable to the Federation.");
311 prout("The Federation will be destroyed.");
314 prout("Since you took the last Klingon with you, you are a");
315 prout("martyr and a hero. Someday maybe they'll erect a");
316 prout("statue in your memory. Rest in peace, and try not");
317 prout("to think about pigeons.");
324 double timused = game.state.date - indate;
325 int ithperd, iwon, klship;
328 if ((timused == 0 || game.state.remkl != 0) && timused < 5.0) timused = 5.0;
329 perdate = (game.state.killc + game.state.killk + game.state.nsckill)/timused;
330 ithperd = 500*perdate + 0.5;
332 if (gamewon) iwon = 100*skill;
333 if (ship == IHE) klship = 0;
334 else if (ship == IHF) klship = 1;
336 if (gamewon == 0) game.state.nromrem = 0; // None captured if no win
337 iscore = 10*game.state.killk + 50*game.state.killc + ithperd + iwon
338 - 100*game.state.basekl - 100*klship - 45*nhelp -5*game.state.starkl - casual
339 + 20*game.state.nromkl + 200*game.state.nsckill - 10*game.state.nplankl + game.state.nromrem;
340 if (alive == 0) iscore -= 200;
342 prout("Your score --");
343 if (game.state.nromkl)
344 prout("%6d Romulans destroyed %5d",
345 game.state.nromkl,20*game.state.nromkl);
346 if (game.state.nromrem)
347 prout("%6d Romulans captured %5d",
348 game.state.nromrem, game.state.nromrem);
349 if (game.state.killk)
350 prout("%6d ordinary Klingons destroyed %5d",
351 game.state.killk, 10*game.state.killk);
352 if (game.state.killc)
353 prout("%6d Klingon commanders destroyed %5d",
354 game.state.killc, 50*game.state.killc);
355 if (game.state.nsckill)
356 prout("%6d Super-Commander destroyed %5d",
357 game.state.nsckill, 200*game.state.nsckill);
359 prout("%6.2f Klingons per stardate %5d",
361 if (game.state.starkl)
362 prout("%6d stars destroyed by your action %5d",
363 game.state.starkl, -5*game.state.starkl);
364 if (game.state.nplankl)
365 prout("%6d planets destroyed by your action %5d",
366 game.state.nplankl, -10*game.state.nplankl);
367 if (game.state.basekl)
368 prout("%6d bases destroyed by your action %5d",
369 game.state.basekl, -100*game.state.basekl);
371 prout("%6d calls for help from starbase %5d",
374 prout("%6d casualties incurred %5d",
377 prout("%6d ship(s) lost or destroyed %5d",
378 klship, -100*klship);
380 prout("Penalty for getting yourself killed -200");
382 proutn("Bonus for winning ");
384 case 1: proutn("Novice game "); break;
385 case 2: proutn("Fair game "); break;
386 case 3: proutn("Good game "); break;
387 case 4: proutn("Expert game "); break;
388 case 5: proutn("Emeritus game"); break;
393 prout("TOTAL SCORE %5d", iscore);
407 proutn("File or device name for your plaque: ");
408 getline(winner, sizeof(winner));
410 proutn("File or device name for your plaque:");
411 fgets(winner, 128, stdin);
412 winner[strlen(winner)-1] = '\0';
414 fp = fopen(winner, "w");
416 prout("Invalid name.");
420 proutn("Enter name to go on plaque (up to 30 characters): ");
421 getline(winner, sizeof(winner));
422 proutn("Enter name to go on plaque (up to 30 characters): ");
423 getline(winner, sizeof(winner));
426 nskip = 38 - strlen(winner)/2;
428 nskip = 64 - strlen(winner)/2;
431 fprintf(fp,"\n\n\n\n");
432 /* --------DRAW ENTERPRISE PICTURE. */
433 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n" );
434 fprintf(fp, " EEE E : : : E\n" );
435 fprintf(fp, " EE EEE E : : NCC-1701 : E\n");
436 fprintf(fp, "EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEE : : : E\n");
437 fprintf(fp, " E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n");
438 fprintf(fp, " EEEEEEEEE EEEEEEEEEEEEE E E\n");
439 fprintf(fp, " EEEEEEE EEEEE E E E E\n");
440 fprintf(fp, " EEE E E E E\n");
441 fprintf(fp, " E E E E\n");
442 fprintf(fp, " EEEEEEEEEEEEE E E\n");
443 fprintf(fp, " EEE : EEEEEEE EEEEEEEE\n");
444 fprintf(fp, " :E : EEEE E\n");
445 fprintf(fp, " .-E -:----- E\n");
446 fprintf(fp, " :E : E\n");
447 fprintf(fp, " EE : EEEEEEEE\n");
448 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEE\n");
449 fprintf(fp, "\n\n\n");
450 fprintf(fp, " U. S. S. ENTERPRISE\n");
451 fprintf(fp, "\n\n\n\n");
452 fprintf(fp, " For demonstrating outstanding ability as a starship captain\n");
454 fprintf(fp, " Starfleet Command bestows to you\n");
456 fprintf(fp,"%*s%s\n\n", nskip, "", winner);
457 fprintf(fp, " the rank of\n\n");
458 fprintf(fp, " \"Commodore Emeritus\"\n\n");
461 case 4: fprintf(fp," Expert level\n\n"); break;
462 case 5: fprintf(fp,"Emeritus level\n\n"); break;
463 default: fprintf(fp," Cheat level\n\n"); break;
466 timestring = ctime(&t);
467 fprintf(fp, " This day of %.6s %.4s, %.8s\n\n",
468 timestring+4, timestring+20, timestring+11);
469 fprintf(fp," Your score: %d\n\n", iscore);
470 fprintf(fp," Klingons per stardate: %.2f\n", perdate);