Files
seta75D ff309bfe1c Init
2021-10-11 18:37:13 -03:00

40 lines
715 B
C

#ifndef lint
static char sccsid[] = "@(#)endgame.c 1.1 94/10/31 SMI"; /* from UCB */
#endif
# include "hangman.h"
/*
* endgame:
* Do what's necessary at the end of the game
*/
endgame()
{
register char ch;
prman();
if (Errors >= MAXERRS)
Errors = MAXERRS + 2;
prword();
prdata();
move(MESGY, MESGX);
if (Errors > MAXERRS)
printw("Sorry, the word was \"%s\"\n", Word);
else
printw("You got it!\n");
for (;;) {
mvaddstr(MESGY + 1, MESGX, "Another word? ");
leaveok(stdscr, FALSE);
refresh();
if ((ch = readch()) == 'n')
die();
else if (ch == 'y')
break;
mvaddstr(MESGY + 2, MESGX, "Please type 'y' or 'n'");
}
leaveok(stdscr, TRUE);
move(MESGY, MESGX);
addstr("\n\n\n");
}