A faithful Python implementation of the classic text adventure game Zork I, originally created by Infocom. This version maintains the spirit of the original while being written in modern Python 3.
You are standing in an open field west of a white house, with a boarded front door.
This Python implementation of Zork includes the complete above-ground and underground areas of the original game, featuring all the classic puzzles, treasures, and memorable encounters that made Zork a defining game of the interactive fiction genre.
- 60+ fully implemented rooms including:
- The iconic white house and surrounding forest
- The Great Underground Empire with its mazes and caverns
- Special areas: Dam, Temple, Land of the Dead, Coal Mine
- Hidden locations and secret passages
- The Troll - Guards the passages with his bloody axe
- The Thief - Randomly appears to relieve you of treasures
- The Cyclops - Guards the treasure room, fears his father's name
- Evil Spirits - Block the entrance to Hades
- Vampire Bat - Fears garlic, guards the jade figurine
- Jewel-encrusted egg with golden canary
- Platinum bar
- Crystal trident
- Pot of gold at the end of the rainbow
- Ivory torch
- Ancient coins
- And many more valuable artifacts
- Dam Control - Manipulate water levels to reveal treasures
- Rainbow Solidification - Use the sceptre to cross the rainbow
- Mirror Room - Break the mirror to connect passages
- Exorcism Ritual - Bell, book, and candles to banish spirits
- Coal to Diamond - Transform coal in the machine
- Rope and Dome - Navigate vertical passages
- Inventory management with weight limits
- Light/darkness system with limited lamp battery
- Combat system for fighting enemies
- Death and resurrection - Return as a spirit
- Score tracking with ranks from Beginner to Master Adventurer
- Save/restore functionality with full game state preservation
- Python 3.8 or higher
- No external dependencies required (uses only Python standard library)
- Clone or download the game
git clone https://github.com/yourusername/zork-python.git
cd zork-python- Run the game
python3 zork_expanded.py- Enter your name when prompted
What is your name, adventurer? > Your Name
north,south,east,west(orn,s,e,w)northeast,northwest,southeast,southwest(orne,nw,se,sw)up,down(oru,d)in,out,enter,exit
take [object]orget [object]- Pick up an itemdrop [object]- Put down an itemexamine [object]orx [object]- Look at something closelyopen [object]- Open doors, containers, etc.close [object]- Close doors, containers, etc.put [object] in [container]- Place items in containers
lookorl- Describe current locationinventoryori- List what you're carryingscore- Check your current scoresave- Save your gamerestore- Load a saved gamequit- Exit the game
light lamp- Turn on the brass lanternturn off lamp- Turn off the lampmove rug- Might reveal something...tie rope to [object]- Secure rope for climbingring bell- Ring the brass belldig- If you have a shovel...pray- At the altar...attack [enemy] with [weapon]- Combat
- Explore thoroughly - Examine everything, try different commands
- Draw a map - The underground can be confusing
- Save often - Before dangerous situations
- Manage your lamp - It has limited battery life (330 turns)
- Some treasures need care - The egg is fragile!
- Read carefully - Descriptions contain important clues
- The thief is tricky - He can steal your treasures
- Death isn't the end - You'll resurrect at the starting location
- Maximum score: 350 points
- Points are earned by:
- Finding treasures
- Depositing treasures in the trophy case
- Solving certain puzzles
- 0-24 points: Beginner
- 25-49 points: Amateur Adventurer
- 50-99 points: Novice Adventurer
- 100-199 points: Junior Adventurer
- 200-299 points: Adventurer
- 300-329 points: Master
- 330-349 points: Wizard
- 350 points: Master Adventurer
# Main game components
ZorkGame # Main game controller
Room # Room/location class
GameObject # Items and objects
Actor # NPCs (troll, thief, etc.)
ParsedCommand # Command parsing result
# Enumerations
Direction # Movement directions
VerbType # Action verbs
ObjectFlag # Object properties
RoomFlag # Room propertieszork-python/
โโโ zork_expanded.py # Complete game implementation
โโโ README.md # This file
โโโ saves/ # Saved games directory
โโโ docs/ # Additional documentation
This implementation stays faithful to the original while adding some modern conveniences:
- Character naming - Personalize your adventure
- Improved parser - More flexible command recognition
- Better save system - JSON-based saves with full state
- Death counter - Track your mortality
- Extended descriptions - Some areas have richer descriptions
- All original puzzles and solutions
- Same treasure values and locations
- Original room connections and maze layout
- Classic combat and NPC behaviors
- Original score system and ranks
- The parser is simpler than Infocom's original
- Some complex command combinations may not work
- No built-in hints system (as in later Infocom games)
The modular design makes it easy to add new content:
# Add a new room
self.rooms["new_room"] = Room(
id="new_room",
name="New Room",
description="Description here...",
flags=RoomFlag.LIT.value,
exits={Direction.NORTH: "other_room"}
)
# Add a new item
self.objects["new_item"] = GameObject(
id="new_item",
name="widget",
description="strange widget",
examine_text="It's a strange widget.",
flags=ObjectFlag.TAKEABLE.value,
location="new_room"
)Contributions are welcome! Areas for improvement:
- Parser enhancements
- Additional NPC interactions
- Sound effects support
- Graphics/mapping integration
- Mobile-friendly interface
"You can't see in the dark"
- You need a light source. Find and light the brass lantern.
"Your load is too heavy"
- Drop some items. You can only carry 7 items at once.
"The troll blocks your way"
- Defeat him with a weapon or pay him with a treasure.
Save/Load not working
- Ensure the script has write permissions in its directory.
- Tim Anderson - Original designer
- Marc Blank - Original designer
- Bruce Daniels - Original designer
- Dave Lebling - Original designer
- Infocom - Original publisher
- Based on the C version translated from FORTRAN
- Inspired by various open-source Zork implementations
- Created with love for the interactive fiction community
This implementation is released under the MIT License. The original Zork game design and text are the property of Activision (who acquired Infocom's assets).
- Zork Map Editor - Visual editor for game maps
- Original Zork Source - Historical MDL source code
- Frotz - Z-machine interpreter
"It is pitch black. You are likely to be eaten by a grue."
Happy adventuring! May you find all the treasures and achieve the rank of Master Adventurer!