xref: /csrg-svn/games/hangman/main.c (revision 46744)
133109Sbostic /*
234781Sbostic  * Copyright (c) 1983 Regents of the University of California.
333109Sbostic  * All rights reserved.
433109Sbostic  *
542578Sbostic  * %sccs.include.redist.c%
633109Sbostic  */
733109Sbostic 
833109Sbostic #ifndef lint
933109Sbostic char copyright[] =
1034781Sbostic "@(#) Copyright (c) 1983 Regents of the University of California.\n\
1133109Sbostic  All rights reserved.\n";
1233109Sbostic #endif /* not lint */
1333109Sbostic 
1433109Sbostic #ifndef lint
15*46744Sbostic static char sccsid[] = "@(#)main.c	5.4 (Berkeley) 02/28/91";
1633109Sbostic #endif /* not lint */
1733109Sbostic 
1833109Sbostic # include	"hangman.h"
1933109Sbostic 
2033109Sbostic /*
2133109Sbostic  * This game written by Ken Arnold.
2233109Sbostic  */
2333109Sbostic main()
2433109Sbostic {
25*46744Sbostic 	void die();
26*46744Sbostic 
2733109Sbostic 	initscr();
2833109Sbostic 	signal(SIGINT, die);
2933109Sbostic 	setup();
3033109Sbostic 	for (;;) {
3133109Sbostic 		Wordnum++;
3233109Sbostic 		playgame();
3333109Sbostic 		Average = (Average * (Wordnum - 1) + Errors) / Wordnum;
3433109Sbostic 	}
3533109Sbostic 	/* NOTREACHED */
3633109Sbostic }
3733109Sbostic 
3833109Sbostic /*
3933109Sbostic  * die:
4033109Sbostic  *	Die properly.
4133109Sbostic  */
42*46744Sbostic void
4333109Sbostic die()
4433109Sbostic {
4533109Sbostic 	mvcur(0, COLS - 1, LINES - 1, 0);
4633109Sbostic 	endwin();
4733109Sbostic 	putchar('\n');
4833109Sbostic 	exit(0);
4933109Sbostic }
50