386BSD 0.1 development
authorWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Tue, 9 Apr 1991 00:57:21 +0000 (16:57 -0800)
committerWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Tue, 9 Apr 1991 00:57:21 +0000 (16:57 -0800)
Work on file usr/othersrc/games/hangman/getguess.c
Work on file usr/othersrc/games/hangman/extern.c
Work on file usr/othersrc/games/hangman/endgame.c
Work on file usr/othersrc/games/hangman/getword.c
Work on file usr/othersrc/games/hangman/main.c
Work on file usr/othersrc/games/hangman/hangman.h
Work on file usr/othersrc/games/hangman/hangman.6
Work on file usr/othersrc/games/hangman/pathnames.h

Co-Authored-By: Lynne Greer Jolitz <ljolitz@cardio.ucsf.edu>
Synthesized-from: 386BSD-0.1

usr/othersrc/games/hangman/endgame.c [new file with mode: 0644]
usr/othersrc/games/hangman/extern.c [new file with mode: 0644]
usr/othersrc/games/hangman/getguess.c [new file with mode: 0644]
usr/othersrc/games/hangman/getword.c [new file with mode: 0644]
usr/othersrc/games/hangman/hangman.6 [new file with mode: 0644]
usr/othersrc/games/hangman/hangman.h [new file with mode: 0644]
usr/othersrc/games/hangman/main.c [new file with mode: 0644]
usr/othersrc/games/hangman/pathnames.h [new file with mode: 0644]

diff --git a/usr/othersrc/games/hangman/endgame.c b/usr/othersrc/games/hangman/endgame.c
new file mode 100644 (file)
index 0000000..4b08d53
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)endgame.c  5.3 (Berkeley) 6/1/90";
+#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");
+}
diff --git a/usr/othersrc/games/hangman/extern.c b/usr/othersrc/games/hangman/extern.c
new file mode 100644 (file)
index 0000000..1dd593d
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)extern.c   5.3 (Berkeley) 6/1/90";
+#endif /* not lint */
+
+# include      "hangman.h"
+
+bool   Guessed[26];
+
+char   Word[BUFSIZ],
+       Known[BUFSIZ],
+       *Noose_pict[] = {
+               "     ______",
+               "     |    |",
+               "     |",
+               "     |",
+               "     |",
+               "     |",
+               "   __|_____",
+               "   |      |___",
+               "   |_________|",
+               NULL
+       };
+
+int    Errors,
+       Wordnum = 0;
+
+double Average = 0.0;
+
+ERR_POS        Err_pos[MAXERRS] = {
+       {  2, 10, 'O' },
+       {  3, 10, '|' },
+       {  4, 10, '|' },
+       {  5,  9, '/' },
+       {  3,  9, '/' },
+       {  3, 11, '\\' },
+       {  5, 11, '\\' }
+};
+
+FILE   *Dict = NULL;
+
+off_t  Dict_size;
diff --git a/usr/othersrc/games/hangman/getguess.c b/usr/othersrc/games/hangman/getguess.c
new file mode 100644 (file)
index 0000000..c363e05
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)getguess.c 5.4 (Berkeley) 6/1/90";
+#endif /* not lint */
+
+# include      "hangman.h"
+
+/*
+ * getguess:
+ *     Get another guess
+ */
+getguess()
+{
+       register int    i;
+       register int    ch;
+       register bool   correct;
+
+       leaveok(stdscr, FALSE);
+       for (;;) {
+               move(PROMPTY, PROMPTX + sizeof "Guess: ");
+               refresh();
+               ch = readch();
+               if (isalpha(ch)) {
+                       if (isupper(ch))
+                               ch = tolower(ch);
+                       if (Guessed[ch - 'a'])
+                               mvprintw(MESGY, MESGX, "Already guessed '%c'", ch);
+                       else
+                               break;
+               }
+               else if (ch == CTRL('D'))
+                       die();
+               else
+                       mvprintw(MESGY, MESGX, "Not a valid guess: '%s'",
+                               unctrl(ch));
+       }
+       leaveok(stdscr, TRUE);
+       move(MESGY, MESGX);
+       clrtoeol();
+
+       Guessed[ch - 'a'] = TRUE;
+       correct = FALSE;
+       for (i = 0; Word[i] != '\0'; i++)
+               if (Word[i] == ch) {
+                       Known[i] = ch;
+                       correct = TRUE;
+               }
+       if (!correct)
+               Errors++;
+}
+
+/*
+ * readch;
+ *     Read a character from the input
+ */
+readch()
+{
+       register int    cnt, r;
+       auto char       ch;
+
+       cnt = 0;
+       for (;;) {
+               if (read(0, &ch, sizeof ch) <= 0)
+               {
+                       if (++cnt > 100)
+                               die();
+               }
+               else if (ch == CTRL('L')) {
+                       wrefresh(curscr);
+                       mvcur(0, 0, curscr->_cury, curscr->_curx);
+               }
+               else
+                       return ch;
+       }
+}
diff --git a/usr/othersrc/games/hangman/getword.c b/usr/othersrc/games/hangman/getword.c
new file mode 100644 (file)
index 0000000..35c5197
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)getword.c  5.3 (Berkeley) 6/1/90";
+#endif /* not lint */
+
+# include      "hangman.h"
+
+# if pdp11
+#      define  RN      (((off_t) rand() << 16) | (off_t) rand())
+# else
+#      define  RN      rand()
+# endif
+
+/*
+ * getword:
+ *     Get a valid word out of the dictionary file
+ */
+getword()
+{
+       register FILE           *inf;
+       register char           *wp, *gp;
+
+       inf = Dict;
+       for (;;) {
+               fseek(inf, abs(RN % Dict_size), 0);
+               if (fgets(Word, BUFSIZ, inf) == NULL)
+                       continue;
+               if (fgets(Word, BUFSIZ, inf) == NULL)
+                       continue;
+               Word[strlen(Word) - 1] = '\0';
+               if (strlen(Word) < MINLEN)
+                       continue;
+               for (wp = Word; *wp; wp++)
+                       if (!islower(*wp))
+                               goto cont;
+               break;
+cont:          ;
+       }
+       gp = Known;
+       wp = Word;
+       while (*wp) {
+               *gp++ = '-';
+               wp++;
+       }
+       *gp = '\0';
+}
+
+/*
+ * abs:
+ *     Return the absolute value of an integer
+ */
+off_t
+abs(i)
+off_t  i;
+{
+       if (i < 0)
+               return -(off_t) i;
+       else
+               return (off_t) i;
+}
diff --git a/usr/othersrc/games/hangman/hangman.6 b/usr/othersrc/games/hangman/hangman.6
new file mode 100644 (file)
index 0000000..8743b09
--- /dev/null
@@ -0,0 +1,50 @@
+.\" Copyright (c) 1983 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by the University of
+.\"    California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"    @(#)hangman.6   6.3 (Berkeley) 6/23/90
+.\"
+.TH HANGMAN 6 "June 23, 1990"
+.UC 4
+.SH NAME
+hangman \- Computer version of the game hangman
+.SH SYNOPSIS
+.B /usr/games/hangman
+.SH DESCRIPTION
+In
+.I hangman,
+the computer picks a word from the on-line word list
+and you must try to guess it.
+The computer keeps track of which letters have been guessed
+and how many wrong guesses you have made on the screen in a graphic fashion.
+.SH FILES
+/usr/dict/words     On-line word list
+.SH AUTHOR
+Ken Arnold
diff --git a/usr/othersrc/games/hangman/hangman.h b/usr/othersrc/games/hangman/hangman.h
new file mode 100644 (file)
index 0000000..c41e5f8
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)hangman.h   5.5 (Berkeley) 2/28/91
+ */
+
+# include      <curses.h>
+# include      <sys/types.h>
+# include      <sys/stat.h>
+# include      <ctype.h>
+# include      <signal.h>
+# include      "pathnames.h"
+
+# define       MINLEN  6
+# define       MAXERRS 7
+
+# define       MESGY   12
+# define       MESGX   0
+# define       PROMPTY 11
+# define       PROMPTX 0
+# define       KNOWNY  10
+# define       KNOWNX  1
+# define       NUMBERY 4
+# define       NUMBERX (COLS - 1 - 26)
+# define       AVGY    5
+# define       AVGX    (COLS - 1 - 26)
+# define       GUESSY  2
+# define       GUESSX  (COLS - 1 - 26)
+
+
+typedef struct {
+       short   y, x;
+       char    ch;
+} ERR_POS;
+
+extern bool    Guessed[];
+
+extern char    Word[], Known[], *Noose_pict[];
+
+extern int     Errors, Wordnum;
+
+extern double  Average;
+
+extern ERR_POS Err_pos[];
+
+extern FILE    *Dict;
+
+extern off_t   Dict_size;
+
+void   die();
+
+off_t  abs();
diff --git a/usr/othersrc/games/hangman/main.c b/usr/othersrc/games/hangman/main.c
new file mode 100644 (file)
index 0000000..47bffb5
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1983 Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)main.c     5.4 (Berkeley) 2/28/91";
+#endif /* not lint */
+
+# include      "hangman.h"
+
+/*
+ * This game written by Ken Arnold.
+ */
+main()
+{
+       void die();
+
+       initscr();
+       signal(SIGINT, die);
+       setup();
+       for (;;) {
+               Wordnum++;
+               playgame();
+               Average = (Average * (Wordnum - 1) + Errors) / Wordnum;
+       }
+       /* NOTREACHED */
+}
+
+/*
+ * die:
+ *     Die properly.
+ */
+void
+die()
+{
+       mvcur(0, COLS - 1, LINES - 1, 0);
+       endwin();
+       putchar('\n');
+       exit(0);
+}
diff --git a/usr/othersrc/games/hangman/pathnames.h b/usr/othersrc/games/hangman/pathnames.h
new file mode 100644 (file)
index 0000000..ebbaefd
--- /dev/null
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)pathnames.h 5.1 (Berkeley) 6/1/90
+ */
+
+#define        _PATH_DICT      "/usr/share/dict/words"