A small console game where the player explores rooms, collects two items, and tries not to walk into the monster.
Could I make a game using only text, rooms, and player choices?
I built most of this in about a day. The player moves between four connected rooms, checks the room for an item, and can add that item to an inventory. Getting the key and potion before reaching the garden wins the game. Entering the kitchen ends it a little faster than planned because that is where the monster is.
The inventory system is the part I am weirdly proud of. It was an early example of making the program remember something the player had already done.
- A nested dictionary stores each room, its exits, and any item inside it.
current_roomtracks the player's location.- A list stores the player's inventory.
- The command loop accepts
go [direction]andget [item]. - Conditional checks decide whether the player wins, meets the monster, or keeps exploring.
The inventory remembers that I picked up an item, but the room does not. In this version, the item stays listed in the room and can be picked up again. Looking back, that is the clearest thing I would rewrite: picking something up should change both the inventory and the room.
I would remove collected items from their rooms and add more rooms to explore.
This project uses Python 3 and no external packages.
python3 src/textadventuregame_jan7.pyThe game explains its commands when it starts.
src/textadventuregame_jan7.py— original source code, preserved unchangedimages/adventure-game-screenshot.png— original gameplay screenshotSOURCE-INTEGRITY.md— checksum for verifying the source file
The original source is intentionally unchanged. The awkward parts are useful evidence too: they show what I understood then and what I would improve now.
