10 /* mode is <0 if scoring, >0 if quitting, =0 if died or won */
12 long i, k, score = 0, mxscor = 0;
14 /* The present scoring algorithm is as follows:
15 * Objective: Points: Present total possible:
16 * Getting well into cave 25 25
17 * Each treasure < chest 12 60
18 * Treasure chest itself 14 14
19 * Each treasure > chest 16 224
20 * Surviving (MAX-NUM)*10 30
22 * Reaching "game.closng" 25 25
23 * "Closed": Quit/Killed 10
27 * Came to Witt's End 1 1
28 * Round out the total 2 2
30 * Points can also be deducted for using hints or too many turns, or for
31 * saving intermediate positions. */
33 /* First tally up the treasures. Must be in building and not broken.
34 * Give the poor guy 2 points just for finding each treasure. */
35 for (i=MINTRS; i<=MAXTRS; i++) {
42 if(game.place[i] == 3 && game.prop[i] == 0)
48 /* Now look at how he finished and how far he got. MAXDIE and
49 * game.numdie tell us how well he survived. game.dflag will tell us
50 * if he ever got suitably deep into the cave. game.closng still
51 * indicates whether he reached the endgame. And if he got as far as
52 * "cave closed" (indicated by "game.closed"), then bonus is zero for
53 * mundane exits or 133, 134, 135 if he blew it (so to speak). */
54 score += (MAXDIE-game.numdie)*10;
56 if(mode == 0)score += 4;
58 if(game.dflag != 0)score += 25;
60 if(game.closng)score += 25;
74 /* Did he come to Witt's End as he should? */
75 if(game.place[MAGZIN] == 108)
83 /* Deduct for hints/turns/saves. Hints < 4 are special; see database desc. */
84 for (i=1; i<=HNTMAX; i++) {
86 score=score-HINTS[i][2];
92 score=score-game.trnluz-game.saved;
94 /* Return to score command if that's where we came from. */
96 SETPRM(1,score,mxscor);
97 SETPRM(3,game.turns,game.turns);
102 /* that should be good enough. Let's tell him all about it. */
103 if(score+game.trnluz+1 >= mxscor && game.trnluz != 0)
105 if(score+game.saved+1 >= mxscor && game.saved != 0)
107 SETPRM(1,score,mxscor);
108 SETPRM(3,game.turns,game.turns);
110 for (i=1; i<=CLSSES; i++) {
111 if(CVAL[i] >= score) {