1 /* @(#)done.c 8.1 (Berkeley) 5/31/93 */
2 /* $NetBSD: done.c,v 1.10 2009/08/25 06:56:52 dholland Exp $ */
5 * Copyright (c) 1991, 1993
6 * The Regents of the University of California. All rights reserved.
8 * The game adventure was originally written in Fortran by Will Crowther
9 * and Don Woods. It was later translated to C and enhanced by Jim
10 * Gillogly. This code is derived from software contributed to Berkeley
11 * by Jim Gillogly at The Rand Corporation.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 /* Re-coding of advent in C: termination routines */
47 { /* sort of like 20000 */
50 maxscore
= myscore
= 0;
51 for (i
= 50; i
<= maxtrs
; i
++) {
52 if (ptext
[i
].txtlen
== 0)
61 if (place
[i
] == 3 && prop
[i
] == 0)
65 myscore
+= (maxdie
- numdie
) * 10;
66 maxscore
+= maxdie
* 10;
67 if (!(scoring
|| gaveup
))
87 if (place
[magazine
] == 108)
92 for (i
= 1; i
<= hintmax
; i
++)
94 myscore
-= hints
[i
][2];
98 /* entry=1 means goto 13000 */ /* game is over */
99 /* entry=2 means goto 20000 */ /* 3=19000 */
108 printf("\n\n\nYou scored %d out of a ", (sc
= score()));
109 printf("possible %d using %d turns.\n", maxscore
, turns
);
110 for (i
= 1; i
<= classes
; i
++)
113 if (i
== classes
- 1) {
114 printf("To achieve the next higher rating");
115 printf(" would be a neat trick!\n\n");
116 printf("Congratulations!!\n");
119 k
= cval
[i
] + 1 - sc
;
120 printf("To achieve the next higher rating, you need");
121 printf(" %d more point", k
);
128 printf("You just went off my scale!!!\n");
141 if (isclosing
) { /* 99 */
146 yea
= yes(81 + numdie
* 2, 82 + numdie
* 2, 54);
148 if (numdie
== maxdie
|| !yea
)
154 for (i
= 100; i
>= 1; i
--) {