LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Blogs > peonuser
User Name
Password

Notices

Rate this Entry

Oldie, but goodie.

Posted 05-01-2012 at 02:27 PM by peonuser

Hunt the Wumpus.
There are several types of games, but lately adventure games seem to be coming back. The original adventures just required a keyboard. No fancy joysticks and or sound cards to deal with. What is really nice about them is that you can use the same source code more or less on a variety of systems. Sometimes that is known as code portability. People even want to put it on the Arduino (a micro-controller). If you do not have an Arduino, you can still play the original game on your desktop system.

You might even be able to put it on your router and play it remotely. You could even put it on a server to play while waiting for some event. Definitely for older or lower resource systems. Wumpus is probably one of the most popular of the original adventure games. Supposedly it was written in BASIC (Beginners all purpose instruction code) and then translated or ported to "C". In fact some of the versions of the code,have the original BASIC code embedded in the comments of the "C" code. Good lesson in learning "C" for beginners.

Here we will go through the set up for a Linux system. Other platforms should at least vaguely resemble this same process.

Download the archive.

$ wget http://www.catb.org/~esr/wumpus/wumpus-1.4.tar.gz

Extract the archive

$ tar zxvf wumpus-1.4.tar.gz
wumpus-1.4/COPYING
wumpus-1.4/Makefile
wumpus-1.4/README
wumpus-1.4/superhack.c
wumpus-1.4/wumpus.6
wumpus-1.4/wumpus.c
wumpus-1.4/wumpus.spec
wumpus-1.4/wumpus.xml

Change to the directory.

$ cd wumpus-1.4

Get a directory listing to see what is there.

wumpus-1.4]$ ls
COPYING README wumpus.6 wumpus.spec
Makefile superhack.c wumpus.c wumpus.xml

Compile the program. (Requires the "C" development system")
wumpus-1.4]$ make
cc wumpus.c -o wumpus
cc superhack.c -o superhack

Get a new listing. See that superhack and wumpus are added. The compiled programs.

wumpus-1.4]$ ls
COPYING README superhack.c wumpus.6 wumpus.spec
Makefile superhack wumpus wumpus.c wumpus.xml

Play wumpus.

wumpus-1.4]$ ./wumpus
INSTRUCTIONS (Y-N)
?y
WELCOME TO 'HUNT THE WUMPUS'
THE WUMPUS LIVES IN A CAVE OF 20 ROOMS. EACH ROOM
HAS 3 TUNNELS LEADING TO OTHER ROOMS. (LOOK AT A
DODECAHEDRON TO SEE HOW THIS WORKS-IF YOU DON'T KNOW
WHAT A DODECAHEDRON IS, ASK SOMEONE)

HAZARDS:
BOTTOMLESS PITS - TWO ROOMS HAVE BOTTOMLESS PITS IN THEM
IF YOU GO THERE, YOU FALL INTO THE PIT (& LOSE!)
SUPER BATS - TWO OTHER ROOMS HAVE SUPER BATS. IF YOU
GO THERE, A BAT GRABS YOU AND TAKES YOU TO SOME OTHER
ROOM AT RANDOM. (WHICH MAY BE TROUBLESOME)
TYPE AN E THEN RETURN
?

Eric Raymond did not like the wumpus interface so he made an alternate version called superhack.

wumpus-1.4]$ ./superhack
Hunt the Superhack
You are in room 8. Exits lead to 1, 7, 9. You have 5 pies left.
I smell perfume!
Droids nearby!
Droids nearby!
Throw, move or help [t,m,?]? ?
Welcome to `Hunt the Superhack'

The superhack lives on the 9th floor of 45 Technology Square in
Cambridge, Massachusetts. Your mission is to throw a pie in his face.

First, you'll have to find him. A botched experiment by an MIT
physics group has regularized the floor's topology, so that each
room has exits to three other rooms. (Look at a dodecahedron to
see how this works --- if you don't know what a dodecahedron is,
ask someone.)

You:
Each turn you may move to an adjacent room or throw a pie. If
you run out of pies, you lose. Each pie can pass through up to
five rooms (connected by a continuous path from where you are). You
aim by telling the computer which rooms you want to throw through.
If the path is incorrect (presumes a nonexistent connection) the
pie moves at random.
If a pie hits the superhack, you win. If it hits you, you lose!

<Press return to continue>

Hazards:
Starlets --- two rooms contain lonely, beautiful women. If you
enter these, you will become fascinated and forget your mission as
you engage in futile efforts to pick one up. You weenie.
Droids --- two rooms are guarded by experimental AI security
droids. If you enter either, the droid will grab you and hustle
you off to somewhere else, at random.
Lusers --- two rooms contain hungry lusers. If you blunder into
either, they will eat one of your pies.
Superhack --- the superhack is not bothered by hazards (the
lusers are in awe of him, he's programmed the droids to ignore him,
and he has no sex life). Usually he is hacking. Two things can
interrupt him; you throwing a pie or you entering his room.

On an interrupt, the superhack moves (3/4 chance) or stays where
he is (1/4 chance). After that, if he is where you are, he flames
you and you lose!

<Press return to continue>

Warnings:
When you are one room away from the superhack or a hazard,
the computer says:
superhack: "I smell a superhack!"
security droid: "Droids nearby!"
starlet: "I smell perfume!"
luser: "Lusers nearby!"
If you take too long finding the superhack, hazards may move. You
will get a warning when this happens.

Commands:
Available commands are:

? --- print long instructions.
m <number> --- move to room with given number.
t <numbers> --- throw through given rooms.

The list of room numbers after t must be space-separated. Anything
other than one of these commands displays a short help message.

You are in room 20. Exits lead to 13, 16, 19. You have 5 pies left.
I smell perfume!
Lusers nearby!
Throw, move or help [t,m,?]?


Enjoy.
Posted in Uncategorized
Views 341 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 08:44 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration