adventure in python

Ported from Fortran IV, Crowther and Woods, 1977
Mike Markowski, mike.ab3ap@gmail.com

In the classic text game adventure, words and imagination hold their own with graphics.

YOU ARE ON THE EDGE OF A BREATH-TAKING VIEW. FAR BELOW YOU IS AN ACTIVE VOLCANO, FROM WHICH GREAT GOUTS OF MOLTEN LAVA COME SURGING OUT, CASCADING BACK DOWN INTO THE DEPTHS. THE GLOWING ROCK FILLS THE FARTHEST REACHES OF THE CAVERN WITH A BLOOD-RED GLARE, GIVING EVERY- THING AN EERIE, MACABRE APPEARANCE. THE AIR IS FILLED WITH FLICKERING SPARKS OF ASH AND A HEAVY SMELL OF BRIMSTONE. THE WALLS ARE HOT TO THE TOUCH, AND THE THUNDERING OF THE VOLCANO DROWNS OUT ALL OTHER SOUNDS. EMBEDDED IN THE JAGGED ROOF FAR OVERHEAD ARE MYRIAD TWISTED FORMATIONS COMPOSED OF PURE WHITE ALABASTER, WHICH SCATTER THE MURKY LIGHT INTO SINISTER APPARITIONS UPON THE WALLS. TO ONE SIDE IS A DEEP GORGE, FILLED WITH A BIZARRE CHAOS OF TORTURED ROCK WHICH SEEMS TO HAVE BEEN CRAFTED BY THE DEVIL HIMSELF. AN IMMENSE RIVER OF FIRE CRASHES OUT FROM THE DEPTHS OF THE VOLCANO, BURNS ITS WAY THROUGH THE GORGE, AND PLUMMETS INTO A BOTTOMLESS PIT FAR OFF TO YOUR LEFT. TO THE RIGHT, AN IMMENSE GEYSER OF BLISTERING STEAM ERUPTS CONTINUOUSLY FROM A BARREN ISLAND IN THE CENTER OF A SULFUROUS LAKE, WHICH BUBBLES OMINOUSLY. THE FAR RIGHT WALL IS AFLAME WITH AN INCANDESCENCE OF ITS OWN, WHICH LENDS AN ADDITIONAL INFERNAL SPLENDOR TO THE ALREADY HELLISH SCENE. A DARK, FOREBODING PASSAGE EXITS TO THE SOUTH.

What's Unique Here?

There are a hundred and one adventure pages out there, so why another? Here are things you won't find elsewhere:


Screenshot of adventure on the HP Prime calculator

Background

More information on the real cave and life events that inspired adventure is available at this great page.

Conversion Effort

I ported adventure from the original FORTRAN IV to python. The initial effort is complete and it appears to be running fine, though the more people who play it the more sure we can be that the port was successful. The program is fairly complex, a massive block of code with few subroutines. The code assumes 36-bit words (cramming five 7-bit ascii chars into one word, yielding the 5-letter commands in the game), characters and integers are treated interchangeably, and then the maze of twisty little GOTOs... :-o These are all things that can't be done in python, resulting in opportunities to introduce bugs in the port. There is a good chance I have taken advantage of those opportunities! Please share bugs you find and, if possible, copy/paste the python stack trace showing the call sequence.

Crowther and Woods 1977 code is available at:

Crowther, W. and Woods, D. “Adventure”. [Aka “ADVENT” and “Colossal Cave”] FORTRAN source code. 1977. Accessed 18 Oct 2024. http://mirror.ifarchive.org/if-archive/games/source/adv350-pdp10.tar.gz

I successfully played to the end, as seen above, so have some confidence that all is well. But I do worry that undiscovered bugs exist. Wear your caving helmet and please email bug reports. Many thanks!

Mike Markowski, mike.ab3ap@gmail.com
Oct 2024

Download

Here are three python versions of the game.

Setting Cave Hours

If the file hours exists, the game will allow play during those hours. By default, adventure can only be played during non-work hours. You can modify hours the same as back in the 70s by starting game and answering as follows:

  1. NO to "Do you want instructions?"
  2. MAGIC MODE must be first command.
  3. YES to "Are you a wizard?"
  4. DWARF, same default password as original,
  5. NO to "Do you know what I thought it was?"

A file hours is created, and must remain in the same directory where you run adventure to be found and used.

I bypassed the password challenge code that comes after the above sequence. It seems unnecessary in this day of single user machines, but can always be put back in place. Of course, you could argue that there is similarly no need for tracking prime time hours, but you have to accommodate nostalgia, too. After modifying hours, the game exits. The new hours are used when run next.

I added a new command RESUMe so that you can resume after a SUSPEnd. Originally, after a suspend it was up to the player to save a copy of the long obsolete magnetic core memory image. Even though the program now saves game state to a file, I left the CORE IMAGE message in for old times' sake and a smile.

Music

Don't start playing the game yet. Set the time machine to 1977 and listen to some hits of the day:

Unfortunately, those lists are only 1977 music. Radio stations of the time would of course play 60s through current. Thanks to the greater variety of music played by college stations I also learned of performers like Synergy, Walter Carlos on the Moog or Kraftwerk from Germany, musicians not otherwise heard then on US stations. Share better playlists if you find them!

Music is rarely mentioned in retro-gaming circles, yet was a huge part of the times for me. Whether at home or in the university lab, I always had the stereo on and tuned to one of the local rock or college stations. As a matter of fact, I continue to do so in my lab at work.

Vocabulary

Little spoiler alert: Part of the charm of adventure is discovering the vocabulary that the game responds to. The challenge is fitting what you want to do into the 1 or 2 word constraint! The full vocabulary is listed here. If you don't mind giving up the enjoyment of discovering the words yourself, look at the list and you will likely find words you never tried.

Maps

Big spoiler alert: To debug my port of adventure I need detailed maps. I wrote subroutines that parse the adventure setup file to do various things.

  1. It lists where initial items of interest are placed.
  2. Generates complete lists of all verbs causing movement from one location to another.
  3. Outputs graphviz dot commands so that maps can be generated.

If you would like to experience virtual caving, do not look at these maps. They take the challenge out of making your own maps and experiencing late 1970s gaming. If you have already spent weeks or months of your life living in Colossal Cave, use the maps to see what you might have missed. With that warning, here are the maps.

Setup File Bug

The adventure program creates Colossal Cave by reading in a separate setup file that fully describes the cave. The file is made up of 12 sections including vocabulary, cave design, object placement, the messages printed during game play, and various other details.

The 1977 set up file has a bug that is not apparent in the execution of the code. However, when writing a parser to make maps and write out various information, the parser discovered (that is, broke!) when encountering the mistake. This will mean little to any unfamiliar with the code, but there is a transition in Section 3:

113 109 46 11 109
which says that to go from room 113 to room 109 the player must enter verb 46, 11, or 109. 46 is SOUTH, 11 is OUT, but there is no verb 109. It has no effect on game play, but is a fun mistake to find 48 years after the fact!

Collosal Cave in VR

THERE IS A LOUD EXPLOSION, AND A TWENTY-FOOT HOLE APPEARS IN THE FAR WALL, BURYING THE DWARVES IN THE RUBBLE. YOU MARCH THROUGH THE HOLE AND FIND YOURSELF IN THE MAIN OFFICE, WHERE A CHEERING BAND OF FRIENDLY ELVES CARRY THE CONQUERING ADVENTURER OFF INTO THE SUNSET. YOU SCORED 350 OUT OF A POSSIBLE 350 USING 344 TURNS. ALL OF ADVENTUREDOM GIVES TRIBUTE TO YOU, ADVENTURER GRANDMASTER! TO ACHIEVE THE NEXT HIGHER RATING WOULD BE A NEAT TRICK! CONGRATULATIONS!!


A DEC PDP-10 in the Main Office

I've also enjoyed working through the cave in VR, great fun. A nice touch is that upon entering the Main Office, a PDP-10 is seen in all its glory! This is the machine that adventure was written on and reference to its architecture is seen throughout the source code. I wish the VR game allowed the player to walk around and see the machine up close.

I took these snapshots while playing the game. The 3d effect is a lot of fun and more impressive than flat 2d snapshots convey.

Here is the trailer on YouTube.

Web Analytics Made Easy - Statcounter