date and time created 87/12/22 13:08:05 by bostic
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Wed, 23 Dec 1987 05:08:05 +0000 (21:08 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Wed, 23 Dec 1987 05:08:05 +0000 (21:08 -0800)
SCCS-vsn: games/hangman/endgame.c 5.1

usr/src/games/hangman/endgame.c [new file with mode: 0644]

diff --git a/usr/src/games/hangman/endgame.c b/usr/src/games/hangman/endgame.c
new file mode 100644 (file)
index 0000000..e50cce7
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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");
+}