xref: /csrg-svn/games/hangman/main.c (revision 34781)
133109Sbostic /*
2*34781Sbostic  * Copyright (c) 1983 Regents of the University of California.
333109Sbostic  * All rights reserved.
433109Sbostic  *
533109Sbostic  * Redistribution and use in source and binary forms are permitted
6*34781Sbostic  * provided that the above copyright notice and this paragraph are
7*34781Sbostic  * duplicated in all such forms and that any documentation,
8*34781Sbostic  * advertising materials, and other materials related to such
9*34781Sbostic  * distribution and use acknowledge that the software was developed
10*34781Sbostic  * by the University of California, Berkeley.  The name of the
11*34781Sbostic  * University may not be used to endorse or promote products derived
12*34781Sbostic  * from this software without specific prior written permission.
13*34781Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*34781Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*34781Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1633109Sbostic  */
1733109Sbostic 
1833109Sbostic #ifndef lint
1933109Sbostic char copyright[] =
20*34781Sbostic "@(#) Copyright (c) 1983 Regents of the University of California.\n\
2133109Sbostic  All rights reserved.\n";
2233109Sbostic #endif /* not lint */
2333109Sbostic 
2433109Sbostic #ifndef lint
25*34781Sbostic static char sccsid[] = "@(#)main.c	5.2 (Berkeley) 06/18/88";
2633109Sbostic #endif /* not lint */
2733109Sbostic 
2833109Sbostic # include	"hangman.h"
2933109Sbostic 
3033109Sbostic /*
3133109Sbostic  * This game written by Ken Arnold.
3233109Sbostic  */
3333109Sbostic main()
3433109Sbostic {
3533109Sbostic 	initscr();
3633109Sbostic 	signal(SIGINT, die);
3733109Sbostic 	setup();
3833109Sbostic 	for (;;) {
3933109Sbostic 		Wordnum++;
4033109Sbostic 		playgame();
4133109Sbostic 		Average = (Average * (Wordnum - 1) + Errors) / Wordnum;
4233109Sbostic 	}
4333109Sbostic 	/* NOTREACHED */
4433109Sbostic }
4533109Sbostic 
4633109Sbostic /*
4733109Sbostic  * die:
4833109Sbostic  *	Die properly.
4933109Sbostic  */
5033109Sbostic die()
5133109Sbostic {
5233109Sbostic 	mvcur(0, COLS - 1, LINES - 1, 0);
5333109Sbostic 	endwin();
5433109Sbostic 	putchar('\n');
5533109Sbostic 	exit(0);
5633109Sbostic }
57