BSD 4_1c_2 release
[unix-history] / usr / src / games / hangman / endgame.c
# 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");
}