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