xref: /csrg-svn/games/hangman/main.c (revision 33109)
1*33109Sbostic /*
2*33109Sbostic  * Copyright (c) 1987 Regents of the University of California.
3*33109Sbostic  * All rights reserved.
4*33109Sbostic  *
5*33109Sbostic  * Redistribution and use in source and binary forms are permitted
6*33109Sbostic  * provided that this notice is preserved and that due credit is given
7*33109Sbostic  * to the University of California at Berkeley. The name of the University
8*33109Sbostic  * may not be used to endorse or promote products derived from this
9*33109Sbostic  * software without specific prior written permission. This software
10*33109Sbostic  * is provided ``as is'' without express or implied warranty.
11*33109Sbostic  */
12*33109Sbostic 
13*33109Sbostic #ifndef lint
14*33109Sbostic char copyright[] =
15*33109Sbostic "@(#) Copyright (c) 1987 Regents of the University of California.\n\
16*33109Sbostic  All rights reserved.\n";
17*33109Sbostic #endif /* not lint */
18*33109Sbostic 
19*33109Sbostic #ifndef lint
20*33109Sbostic static char sccsid[] = "@(#)main.c	5.1 (Berkeley) 12/22/87";
21*33109Sbostic #endif /* not lint */
22*33109Sbostic 
23*33109Sbostic # include	"hangman.h"
24*33109Sbostic 
25*33109Sbostic /*
26*33109Sbostic  * This game written by Ken Arnold.
27*33109Sbostic  */
28*33109Sbostic main()
29*33109Sbostic {
30*33109Sbostic 	initscr();
31*33109Sbostic 	signal(SIGINT, die);
32*33109Sbostic 	setup();
33*33109Sbostic 	for (;;) {
34*33109Sbostic 		Wordnum++;
35*33109Sbostic 		playgame();
36*33109Sbostic 		Average = (Average * (Wordnum - 1) + Errors) / Wordnum;
37*33109Sbostic 	}
38*33109Sbostic 	/* NOTREACHED */
39*33109Sbostic }
40*33109Sbostic 
41*33109Sbostic /*
42*33109Sbostic  * die:
43*33109Sbostic  *	Die properly.
44*33109Sbostic  */
45*33109Sbostic die()
46*33109Sbostic {
47*33109Sbostic 	mvcur(0, COLS - 1, LINES - 1, 0);
48*33109Sbostic 	endwin();
49*33109Sbostic 	putchar('\n');
50*33109Sbostic 	exit(0);
51*33109Sbostic }
52