Skip to main content
This assignment is due on Friday, September 12, 2025 at 11:59PM EST.

Homework 0: Build a Text-Adventure Game

Instructions

In this homework assignment, you will write your own classic text adventure game. You will implement two text adventure games. One will be a re-implementation of the Action Castle game, and one will be a game that you design yourself. The game that you design can be on any topic, or can tell any story of your choice.

Using our Starter code

We have provided starter code for a basic text adventure game. I recommend using Deepnote, for which you can get a free student account, but you can also use Google Colab or a local IDE such as VSCode.

You should start the assignment by reviewing the hw0_tutorial.ipynb which introduces the concepts in our starter code.

Try out the Tutorial

After you have downloaded the code, you should work through the hw0_tutorial.ipynb notebook that we created to show off the basics of our text adventure game platform. Here’s a screenshot of the notebook that you’ll see.

Visualization module

Our starter code includes a vizualize tool text_adventure_games.viz which will allow you to view your game map as a directed graph. To use this, you will also need to install graphviz. There is both the graphviz app and the graphviz python library, which is a wrapper for the app. You can find instructions on how to install graphviz from their website here: graphviz.org/download/

There is a command in the ipynb that will install graphviz for you via requirements.txt.

Task 1: Implement Action Castle

Action Castle is a game by Jared A. Sorensen. It is included in his book Parsley, which is a collection of games inspired by the text-adventures of the 1980s. Parsley is a party game where you take on the role of the parser, and the players shout out commands like GO NORTH, LIGHT LAMP or GET SWORD. You obtusely follow player’s commands, simulating a computer’s limited vocabulary. The effect is suprisingly hilarious and fun.

You can download the free “Parsely: Preview n’ Play Edition” here or directly from Jared’s website. It contains the Action Castle game that you’ll be implementing. You can also buy the full Parsley book for $20 if you’d like to support an awesome indy game developer. The Preview n’ Play Edition also explains how these kinds of games work.

We have implemented most of Action Castle for you.

  1. We created the 13 locations from Action Castle (Cottage, Garden Path, Fishing Pond, Winding Path, Top of the Tall Tree, Drawbridge, Courtyard, Tower Stairs, Tower, Dungeon Stairs, Dungeon, Great Feasting Hall, Throne Room).
  2. We created most of the items for the game (fishing poll, rosebush, club, fish, the troll, etc.).

You will need to update the code so that it can:

  1. Add blocks to the game (these are puzzles that the player needs to solve in order to make progress). You should add blocks in
    • The courtyard - the guard prevents you from going east
    • The dungeon stairs - the darkness prevents you from going down
    • The tower stairs - the locked door prevents you from going up
  2. Add special actions for the Action Castle game. You should add Actions for:
    • Unlocking the door
    • Reading the runes to banish the ghost from the dungeon
    • Proposing marriage (to the princess)
    • Sitting on the throne, which requires you to be royal and wearing the crown

Need a hint on how to get started? Check out the Troll_Block class to see an example of how to implement a Block, and the Eat class as an example of how to implement an Action.

Want to know how to win the game? Here’s a sequence of actions that should result in a winning state, if you’ve implemented the game correctly. You can play through the full Action Castle game with the following commands: take pole, go out, go south, catch fish with pole, go north, pick rose, smell rose, go north, go up, get branch, go down, go east, give the troll the fish, go east, hit guard with branch, get key, go east, get candle, go west, go down, light lamp, go down, light candle, read runes, get crown, go up, go up, go up, unlock door, go up, give rose to the princess, propose to the princess, wear crown, down, down, east, east, sit on throne

Task 2: Implement Your Own Creation

Your game should include all of the following:

  • At least 3 Locations
  • At least 3 Items that can be interacted with. These can be doors, keys, tools, ogres, etc.
  • At least one “puzzle” where there are certain preconditions that must be met before the player can make forward progress. This could be an Action or a Block.
  • At least one “win” state and at least one “lose” state.

A fun example of a tiny game with very 3 locations and 3 items is the “Flaming Goat” game in Jared A. Sorensen’s Parsley book.

Optionally, you can think about adding other elements to your game, like:

  • Scoring
  • Changes over time
  • Interesting non-player characters

Feel free to modify the starter code in any way you see fit in order to enable your game ideas. However, the “Play the game” and “Visualize your game” code blocks should remain functional.

What kind of game should you make? It’s up to you! Be creative! For inspiration, we recommend searching Pinterest for cross-section maps. Here are some that we like:

Tip: I recommend drawing out your game on graph paper before you get started.

What to submit

You should submit a link to a Github repository which contains the following:

  1. An Python notebook called action_castle.ipynb that runs Action Castle.
  2. An Python notebook called my_game.ipynb that runs the initial version of your game.
  3. A text file called playthrough.txt with all of the commands that we need to issue to complete your game. It shold be a plain text file with one command per line.
  4. A text file called README.md containing a short paragraph describing your game, and why you picked that topic.
  5. An image showing the directed graph for your game.

Submissions should be done on Blackboard.

Grading

  • Implement Action Castle - 5 points
  • Implement Your Own Creation - 5 points