Return if the arrow hit something after moving randomly
[wumpus.git] / wumpus.c
index bf9f0a6534955fc784c927f5d2fcdcf9b1d65806..2adc696d8179cc80d44252a4f5f6eba73d01e469 100644 (file)
--- a/wumpus.c
+++ b/wumpus.c
@@ -2,10 +2,7 @@
  * wumpus.c --- a faithful translation of the classic "Hunt The Wumpus" game.
  *
  * Translator: Eric S. Raymond <esr@snark.thyrsus.com>
- * Version: $Id: wumpus.c,v 1.3 1993/11/07 19:19:27 esr Exp esr $
- *
- * This was the state of the art 20 years ago, in 1972.  We've come a long
- * way, baby.
+ * Version: $Id: wumpus.c,v 1.4 1996/05/17 17:30:35 esr Exp esr $
  *
  * The BASIC source is that posted by Magnus Olsson in USENET article
  * <9207071854.AA21847@thep.lu.se>: he wrote
  *
  * So, pretend for a little while that your workstation is an ASR-33 and
  * limber up your fingers for a trip to nostalgia-land...
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
  */
 
 #include <stdio.h>
 #include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <time.h>
+#include <sys/socket.h>
 
 /* 5 REM *** HUNT THE WUMPUS ***                                       */
 
@@ -125,8 +129,6 @@ char *prompt;
 
 void print_instructions()
 {
-    char ebuf[BUFSIZ];
-
 /* 375 REM *** INSTRUCTIONS ***                                                */
 /* 380 PRINT "WELCOME TO 'HUNT THE WUMPUS'"                            */
     puts("WELCOME TO 'HUNT THE WUMPUS'");
@@ -353,6 +355,7 @@ badrange:
                check_shot();
                if (finished != NOT)
                    return;
+               goto nextpath;
            }
 
            /* 820 NEXT K1                                              */
@@ -364,11 +367,13 @@ badrange:
 
        /* 835 GOTO 900                                                 */
        check_shot();
+       if (finished != NOT)
+           return;
 
        /* 840 NEXT K                                                   */
+       nextpath: ;
     }
 
-ammo:
     if (finished == NOT)
     {
        /* 845 PRINT "MISSED"                                           */
@@ -523,7 +528,7 @@ goodmove:
     }
 }
 
-main(argc, argv)
+int main(argc, argv)
 int argc;
 char *argv[];
 {