+/*
+ * Copyright (c) 1987 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)endgame.c 5.1 (Berkeley) %G%";
+#endif /* not lint */
+
+# 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");
+}