projects
/
wumpus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
NEWS update.
[wumpus.git]
/
wumpus.c
diff --git
a/wumpus.c
b/wumpus.c
index 8b3cc47354eab835e2b27ea8fcb2a9ebaceb4d21..6068fd689d4af240b4035bdc8a2b0cdf6bc410dc 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>
* wumpus.c --- a faithful translation of the classic "Hunt The Wumpus" game.
*
* Translator: Eric S. Raymond <esr@snark.thyrsus.com>
- * Version: $Id$
- *
- * 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
*
* The BASIC source is that posted by Magnus Olsson in USENET article
* <9207071854.AA21847@thep.lu.se>: he wrote
@@
-31,6
+28,12
@@
*/
#include <stdio.h>
*/
#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 *** */
/* 5 REM *** HUNT THE WUMPUS *** */
@@
-102,22
+105,28
@@
int getnum(prompt)
char *prompt;
{
(void) printf("%s\n?", prompt);
char *prompt;
{
(void) printf("%s\n?", prompt);
- (void) fgets(inp, sizeof(inp), stdin);
- return(atoi(inp));
+ if (fgets(inp, sizeof(inp), stdin))
+ return(atoi(inp));
+ else {
+ fputs("\n",stdout);
+ exit(1);
+ }
}
int getlet(prompt)
char *prompt;
{
(void) printf("%s\n?", prompt);
}
int getlet(prompt)
char *prompt;
{
(void) printf("%s\n?", prompt);
- (void) fgets(inp, sizeof(inp), stdin);
- return(inp[0]);
+ if (fgets(inp, sizeof(inp), stdin))
+ return(toupper(inp[0]));
+ else {
+ fputs("\n",stdout);
+ exit(1);
+ }
}
void print_instructions()
{
}
void print_instructions()
{
- char ebuf[BUFSIZ];
-
/* 375 REM *** INSTRUCTIONS *** */
/* 380 PRINT "WELCOME TO 'HUNT THE WUMPUS'" */
puts("WELCOME TO 'HUNT THE WUMPUS'");
/* 375 REM *** INSTRUCTIONS *** */
/* 380 PRINT "WELCOME TO 'HUNT THE WUMPUS'" */
puts("WELCOME TO 'HUNT THE WUMPUS'");
@@
-359,7
+368,6
@@
badrange:
/* 840 NEXT K */
}
/* 840 NEXT K */
}
-ammo:
if (finished == NOT)
{
/* 845 PRINT "MISSED" */
if (finished == NOT)
{
/* 845 PRINT "MISSED" */
@@
-514,7
+522,7
@@
goodmove:
}
}
}
}
-main(argc, argv)
+
int
main(argc, argv)
int argc;
char *argv[];
{
int argc;
char *argv[];
{