1 /*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 */
7
8 #ifndef lint
9 static char sccsid[] = "@(#)endgame.c 8.1 (Berkeley) 05/31/93";
10 #endif /* not lint */
11
12 # include "hangman.h"
13
14 /*
15 * endgame:
16 * Do what's necessary at the end of the game
17 */
endgame()18 endgame()
19 {
20 register char ch;
21
22 prman();
23 if (Errors >= MAXERRS)
24 Errors = MAXERRS + 2;
25 prword();
26 prdata();
27 move(MESGY, MESGX);
28 if (Errors > MAXERRS)
29 printw("Sorry, the word was \"%s\"\n", Word);
30 else
31 printw("You got it!\n");
32
33 for (;;) {
34 mvaddstr(MESGY + 1, MESGX, "Another word? ");
35 leaveok(stdscr, FALSE);
36 refresh();
37 if ((ch = readch()) == 'n')
38 die();
39 else if (ch == 'y')
40 break;
41 mvaddstr(MESGY + 2, MESGX, "Please type 'y' or 'n'");
42 }
43
44 leaveok(stdscr, TRUE);
45 move(MESGY, MESGX);
46 deleteln();
47 deleteln();
48 deleteln();
49 }
50
51
52
53
54
55
56
57
58
59
60