Zork!

screenshot of zork! screenshot of zork!

 

Description:

Zork! was made as an exercise for the game programming in C++ course I followed during my masters. It was written in less than 2 weeks.

Zork! is an engine for text based adventures and comes with a small sample adventure. New adventures can easily be made for it.


Challenges:

As this was one of the first programs I wrote in C++ the biggest challenge here was to combine the already familiar C syntax with OOP and design patterns.

Another big challenge was to create a working verb-noun parser as it's really hard to predict the commands the user is going to enter.


Features:

  • Easy to create new adventures.
  • Verb-noun parser that recognizes the following commands:
    • inventory
    • go to [room]
    • open [object]
    • pick up [object]
    • examine [object]
    • use [object] with [object]
    • exit

Media:

screenshot of zork! screenshot of zork!

Code Snippets:

Object.h
Header file of the base object class from which all objects inherit.

VerbNounParser.h
The header file of the verb-noun parser. Implements the singleton design pattern.


Downloads:

You can download the game here.
Unzip the game to a folder (make sure the .exe is next to the "source" folder containing the rooms.txt file) and play!