*
* Author: Eric S. Raymond <esr@snark.thyrsus.com>
*
- * My update of a classic adventure game. The C is crude because it's
- * a hack on a line-by-line translation of a BASIC `Hunt The Wumpus'.
- * This code is no relation to the elaborate dungeon game called `Hack'.
+ * My update of a classic adventure game. This code is no relation to
+ * the elaborate dungeon game called `Hack'.
*
* Any resemblance to persons living or dead is strictly coincidental. And
* if you believe *that*...
#include <stdio.h>
#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/socket.h>
static int path[5];
static int j, k, scratchloc, pies;
void print_instructions()
{
- char ebuf[BUFSIZ];
-
PM("Welcome to `Hunt the Superhack'\n")
PM(" The superhack lives on the 9th floor of 45 Technology Square in");
}
for (k = 0; k < j9; k++)
- if (path[k] == path[k - 2])
+ if (k >= 2 && path[k] == path[k - 2])
{
(void) puts("Pies can't fly that crookedly --- try again.");
return;
}
- ammo:
if (finished == NOT)
{
(void) puts("You missed.");
PM("Yow! You interrupted the superhack.");
move_superhack();
}
- else if (scratchloc == loc[STARLET1] || scratchloc == loc[STARLET1])
+ else if (scratchloc == loc[STARLET1] || scratchloc == loc[STARLET2])
{
PM("You begin to babble at an unimpressed starlet. You lose!");
finished = LOSE;
}
}
-main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
{
if (argc >= 2 && strcmp(argv[1], "-s") == 0)
srand(atoi(argv[2]));
break;
}
}
+ return 0;
}
/* superhack.c ends here */