xref: /csrg-svn/games/hangman/main.c (revision 60809)
133109Sbostic /*
2*60809Sbostic  * Copyright (c) 1983, 1993
3*60809Sbostic  *	The Regents of the University of California.  All rights reserved.
433109Sbostic  *
542578Sbostic  * %sccs.include.redist.c%
633109Sbostic  */
733109Sbostic 
833109Sbostic #ifndef lint
9*60809Sbostic static char copyright[] =
10*60809Sbostic "@(#) Copyright (c) 1983, 1993\n\
11*60809Sbostic 	The Regents of the University of California.  All rights reserved.\n";
1233109Sbostic #endif /* not lint */
1333109Sbostic 
1433109Sbostic #ifndef lint
15*60809Sbostic static char sccsid[] = "@(#)main.c	8.1 (Berkeley) 05/31/93";
1633109Sbostic #endif /* not lint */
1733109Sbostic 
1833109Sbostic # include	"hangman.h"
1933109Sbostic 
2033109Sbostic /*
2133109Sbostic  * This game written by Ken Arnold.
2233109Sbostic  */
main()2333109Sbostic main()
2433109Sbostic {
2546744Sbostic 	void die();
2646744Sbostic 
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  */
4246744Sbostic void
die()4333109Sbostic die()
4433109Sbostic {
4533109Sbostic 	mvcur(0, COLS - 1, LINES - 1, 0);
4633109Sbostic 	endwin();
4733109Sbostic 	putchar('\n');
4833109Sbostic 	exit(0);
4933109Sbostic }
50