xref: /csrg-svn/games/hangman/endgame.c (revision 60809)
133106Sbostic /*
2*60809Sbostic  * Copyright (c) 1983, 1993
3*60809Sbostic  *	The Regents of the University of California.  All rights reserved.
433106Sbostic  *
542578Sbostic  * %sccs.include.redist.c%
633106Sbostic  */
733106Sbostic 
833106Sbostic #ifndef lint
9*60809Sbostic static char sccsid[] = "@(#)endgame.c	8.1 (Berkeley) 05/31/93";
1033106Sbostic #endif /* not lint */
1133106Sbostic 
1233106Sbostic # include	"hangman.h"
1333106Sbostic 
1433106Sbostic /*
1533106Sbostic  * endgame:
1633106Sbostic  *	Do what's necessary at the end of the game
1733106Sbostic  */
endgame()1833106Sbostic endgame()
1933106Sbostic {
2033106Sbostic 	register char	ch;
2133106Sbostic 
2233106Sbostic 	prman();
2333106Sbostic 	if (Errors >= MAXERRS)
2433106Sbostic 		Errors = MAXERRS + 2;
2533106Sbostic 	prword();
2633106Sbostic 	prdata();
2733106Sbostic 	move(MESGY, MESGX);
2833106Sbostic 	if (Errors > MAXERRS)
2933106Sbostic 		printw("Sorry, the word was \"%s\"\n", Word);
3033106Sbostic 	else
3133106Sbostic 		printw("You got it!\n");
3233106Sbostic 
3333106Sbostic 	for (;;) {
3433106Sbostic 		mvaddstr(MESGY + 1, MESGX, "Another word? ");
3533106Sbostic 		leaveok(stdscr, FALSE);
3633106Sbostic 		refresh();
3733106Sbostic 		if ((ch = readch()) == 'n')
3833106Sbostic 			die();
3933106Sbostic 		else if (ch == 'y')
4033106Sbostic 			break;
4133106Sbostic 		mvaddstr(MESGY + 2, MESGX, "Please type 'y' or 'n'");
4233106Sbostic 	}
4333106Sbostic 
4433106Sbostic 	leaveok(stdscr, TRUE);
4533106Sbostic 	move(MESGY, MESGX);
4657824Selan 	deleteln();
4757824Selan 	deleteln();
4857824Selan 	deleteln();
4933106Sbostic }
5057824Selan 
5157824Selan 
5257824Selan 
5357824Selan 
5457824Selan 
5557824Selan 
5657824Selan 
5757824Selan 
5857824Selan 
5957824Selan 
60