1 /* $NetBSD: done.c,v 1.9 2005/07/01 00:03:36 jmc Exp $ */
4 * Copyright (c) 1991, 1993
5 * The Regents of the University of California. All rights reserved.
7 * The game adventure was originally written in Fortran by Will Crowther
8 * and Don Woods. It was later translated to C and enhanced by Jim
9 * Gillogly. This code is derived from software contributed to Berkeley
10 * by Jim Gillogly at The Rand Corporation.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 #include <sys/cdefs.h>
40 static char sccsid
[] = "@(#)done.c 8.1 (Berkeley) 5/31/93";
42 __RCSID("$NetBSD: done.c,v 1.9 2005/07/01 00:03:36 jmc Exp $");
46 /* Re-coding of advent in C: termination routines */
55 { /* sort of like 20000 */
58 maxscore
= myscore
= 0;
59 for (i
= 50; i
<= maxtrs
; i
++) {
60 if (ptext
[i
].txtlen
== 0)
69 if (place
[i
] == 3 && prop
[i
] == 0)
73 myscore
+= (maxdie
- numdie
) * 10;
74 maxscore
+= maxdie
* 10;
75 if (!(scoring
|| gaveup
))
95 if (place
[magazine
] == 108)
100 for (i
= 1; i
<= hintmax
; i
++)
102 myscore
-= hints
[i
][2];
106 /* entry=1 means goto 13000 */ /* game is over */
107 /* entry=2 means goto 20000 */ /* 3=19000 */
116 printf("\n\n\nYou scored %d out of a ", (sc
= score()));
117 printf("possible %d using %d turns.\n", maxscore
, turns
);
118 for (i
= 1; i
<= classes
; i
++)
121 if (i
== classes
- 1) {
122 printf("To achieve the next higher rating");
123 printf(" would be a neat trick!\n\n");
124 printf("Congratulations!!\n");
127 k
= cval
[i
] + 1 - sc
;
128 printf("To achieve the next higher rating, you need");
129 printf(" %d more point", k
);
136 printf("You just went off my scale!!!\n");
149 if (isclosing
) { /* 99 */
154 yea
= yes(81 + numdie
* 2, 82 + numdie
* 2, 54);
156 if (numdie
== maxdie
|| !yea
)
162 for (i
= 100; i
>= 1; i
--) {