Adventure Game

On of the early computer games was Adventure written by Will Crowther in the 1970's.

There are several versions of this game on the web, in case you want to play, each of them more or less true to the original, and at least one version for Android in the google store.

How the game was originally played

The player starts up the program, and after it has initialized, it prints
WELCOME TO ADVENTURE! WOULD YOU LIKE INSTRUCTIONS?
if the player answers yes, it prints
SOMEWHERE NEARBY IS COLOSSAL CAVE, WHERE OTHERS HAVE FOUND FORTUNES IN TREASURE AND GOLD, THOUGH IT IS RUMORED THAT SOME WHO ENTER ARE NEVER SEEN AGAIN. MAGIC IS SAID TO WORK IN THE CAVE. I WILL BE YOUR EYES AND HANDS. DIRECT ME WITH COMMANDS OF 1 OR 2 WORDS. (ERRORS, SUGGESTIONS, COMPLAINTS TO CROWTHER) (IF STUCK TYPE HELP FOR SOME HINTS)
and then a description of "room" 1, which is
YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING . AROUND YOU IS A FOREST. A SMALL STREAM FLOWS OUT OF THE BUILDING AND DOWN A GULLY.
at this point the player can type WEST, W, or ROAD to go to "room" 2, where the description is
YOU HAVE WALKED UP A HILL, STILL IN THE FOREST THE ROAD NOW SLOPES BACK DOWN THE OTHER SIDE OF THE HILL. THERE IS A BUILDING IN THE DISTANCE.
unfortunately room 2 is a distraction. You can come back by typing EAST, and you'll again get the description of room 1. You really want to go to room 3, and you can get there by typing ENTER, BUILDING, INSIDE, or EAST. The description of room 3 is
YOU ARE INSIDE A BUILDING, A WELL HOUSE FOR A LARGE SPRING.
but it is immediately followed by a description of some important objects:
THERE ARE SOME KEYS ON THE GROUND HERE. THERE IS A SHINY BRASS LAMP NEARBY.
The player must eventually take the objects to continue with the game, and when you do, the messages describing them to longer appear. To take the keys the player types TAKE KEYS or GET KEYS or PICKUP KEYS or one of many other possible verbs, and similarly for the lamp. (As the player moves from room to room, eventually there is a locked grate to open, which requires you to have the keys with you.)

Later versions of the game kept score, keeping track of how many moves you made, and giving you points when you did something useful, like picking up the keys, but in the version we will work with, although you can win or lose, and there are obvious steps along the way, there are no points.

An important feature of the gameplay is the fact that you seem to be talking almost naturally to the game, even though it has a tiny vocabulary. Given how hard it is to type on a phone, this may be a problem for our implementation.

Technical description

As it happens we have the source file and the data file for that game, and we are going to rewrite it for android.

The source is in Fortran IV. Fortran was one of the first higher-level languages, and you might be able to puzzle out what the program does by reading the code. Probably you could compile the game if you could get ahold of an appropriate compiler, although Fortran IV was superceded by Fortran '77 and later Fortran '90.

Luckily the data file is quite easy to decipher (although unluckily most of the scoring and action of the game is in the code.)

Our implementation

You obviously will have to write Java code to replace the Fortran, but you might consider completely ignoring the Fortran code, just using the features visible in the data file, but not necessarily placing every item in the same place.

This is a good place for the Model-View-Controller scheme; you can model the game as series of Room classes, each with a description, and a list of adjacent rooms.

I started out to do that but didn't really get very far. You may start with my code if you want, but notice that you'll have to rewrite the input and output for Android. You'll also want to add package statements to each Java file.

The user interface, which is the view of the game, shows you the current room description, and provides a way to input your desires. The game could display only words it would understand at this point, perhaps on buttons or a pulldown. Or you could type, as in the original game. Another idea is a pulldown which has the full vocabulary. Or a perfectly good scheme is to require the player to do a lot of typing. This has the nice feature that it fits into the existing initialization file fairly easily.

you will turn in:

  1. listings of any code, including Java and XML, that you wrote or modified.
  2. A description of the gameplay in your version of the game
  3. A description of features of the game which your code implements
  4. A screenshot of the emulator playing your version of the game.