CPSC 240 - OOA&D - Spring 2019

Homework #9 — "Zork++" phase 4: masterpiece

Possible experience: +50XP

Due: Wednesday, May 1st, midnight


This is an individual assignment, not a team assignment. You should not work together with your teammates while completing it. (Getting their formative feedback on your work, however, is okay and even encouraged.)

Your individual dungeon should show evidence of independent thinking and creativity. It should not be a near-replica of one or both of your teammates' individual dungeons. Ideally, when playing them, it shouldn't even occur to the player that the three individual dungeons written by the teammates "go with" the same game engine (unless there are obvious distinctive features in the game play that might tip the player off to this.)

Zork++ dungeon

Your mission is to design a dungeon compatible with your team's text-based game engine. It should be entertaining, challenging, and winnable. You will submit it as a single .zork file, plus a walk-through .txt file.


Please adhere to the following requirements when preparing your dungeon file.

  1. When the dungeon is first started, a clear description of how to win the game should appear. If your game engine has the ability to display introductory text beyond just the dungeon title, you can include this information there. Otherwise, you can include it in the entry room description.

    Examples of win descriptions: In other words, the specificity can vary, as long as the player has some idea of what he/she is supposed to do.
  2. It must have at least 20 rooms. Each room description should have at least two sentences, and no more than five sentences. (In other words, each room description should have 2, 3, 4, or 5 sentences.) The entry room is an exception to this rule: if you put your win criteria in the entry room description, it can have more than five total sentences.
  3. It must have at least 10 items. Each item must have an "examine" verb that prints out a one-sentence description of the item in question.
  4. It must exercise every feature of your game engine. Some of your features may not be "exercisable" — like a verbose command, for example. You don't have to do anything to take advantage of that feature in your .zork file. However, if your game engine supports armor slots for combat, you'd better have some armor that fits in the armor slots somewhere in your file. If it supports light, you'd better have some light sources and some rooms that are normally dark. Etc.
  5. In addition to your myCoolDungeon.zork file, you must also include a myCoolDungeon.txt file that includes walk-through instructions. This file will consist of plain text (i.e., English sentences and paragraphs) and can be edited using vim just like any other text file can. It should explain in sufficient detail which commands to execute in which order to win the game from your dungeon's starting state. This file must be understandable by a child who reads at a 9th grade level.

Two whole sentences?? Wut??

Your room descriptions are the primary way that the atmosphere of your game will be conveyed to the player. Take some time and spell out enough detail that your players can appreciate (and remember) each room.

No more than five sentences?? Wut??

"More words" does not (remotely) equal "a better or more vivid description." Nobody likes to read a wall of text. Your dungeon should flow smoothly, and take into account the reader's time commitment when they enter new rooms. Strive to express rich descriptions in fewer words. This makes for better writing, not worse.

Making your game determinstic

Note that your dungeon will contain random components that make each play of the dungeon different. (At the very least, your teleport event(s) will put the adventurer in a random location each time. Also, NPCs may choose to move to different rooms, combat may resolve differently, etc.) You will want to make this deterministic for purposes of testing, so that your walk-through will always "work" in the same way. To accomplish this, your team should do the following in your game engine:

  1. Make sure you only instantiate one java.util.Random object over the entire run of the program. The easiest way to do this is to make an instance variable of type Random in your GameState class, initialize it in the GameState constructor, and in every place where you need to roll a random number, access that Random object and call .nextInt() or .nextBoolean() or whatever to do so.
  2. Immediately after instantiating the Random object, call ".setSeed(13)" on it. (If you don't like the number 13, substitute any other number you do like.)

After doing this, you should discover that your game runs the same way every time you play it.


My sons are going to play each dungeon for about 10 minutes. That may not sound like much, but there are 39 dungeons they have to go through, and they have lives outside of Zork. So be aware that anything cool you want them to see and experience should be discoverable in that amount of time. Don't make stuff so impossible to figure out that they miss half your dungeon.

Also, please no profanity or sexual references. And please only mild violence.

Turning it in

To turn in this assignment, commit and push your .zork and .txt files to the "files" directory of your project. I will get your most recent code and those files directly from the github repo. Then send me an email with subject line "CPSC 240 Zork++ dungeon turn-in" whose body gives me the name of those two files. The body should also give me your team number, and also say, "Good luck, Davies family!"

I need help!

Come to office hours, or send email with subject line "CPSC 240 Zork++ dungeon HELP!!!"