Learn Python in 30 Days — Day 14: Week 2 Review
Learn Python in 30 Days — Day 14: Week 2 Review
Project: Tiny Dungeon — Tactics & Monsters
Welcome to Day 14 of the Learn Python in 30 Days series!
Today, you’ll bring together everything from Weeks 1 and 2 to create a playable Tiny Dungeon right inside your terminal.
We’ll build this step-by-step, adding a concept from each day along the way.
You’ll Use (Days 1–13)
-
Days 1–4:
print(),input(), variables, arithmetic & comparison operators -
Days 5–6:
if / elif / else, chained conditions, clean indentation -
Days 8–9: loops (
for,while) -
Day 10: lists (battle log, attacks, room order)
-
Day 11: tuples (fixed configs), sets (weakness tags, inventory)
-
Day 12: dictionaries (player, monsters, rooms)
-
Day 13: nested structures (lists + dicts + sets) and looping through them
How to Play
Move: go north, south, east, west
Battle: attack <name>, heal, guard, info, bag, log
Explore to find items (set-based inventory) and exploit monster weaknesses (set intersection bonus).
There’s no randomness victory depends on your planning, stamina management, and timing.
Building the Dungeon — One Day at a Time
🗓 Day 1 — Print & Say Hello
💡 Every program starts with output.
Try adding a welcome tip line under it.
🗓 Day 2 — Variables & Simple Data
💡 Keeps state tidy and readable.
Try lowering starting HP to 15 to see how it changes difficulty.
🗓 Day 3 — Input (Your Command Loop)
💡 Your event loop — the heart of every terminal game.
Try adding a help command listing available actions.
🗓 Day 4 — Operators & Expressions
💡 Math controls healing and damage.
Try subtracting 1 stamina per turn using clamp.
🗓 Day 5 — Conditionals (if / elif / else)
💡 Branching logic turns input into behaviour.
Add a bag command to display HP & inventory.
🗓 Day 6 — Chaining Conditions
💡 Combines multiple tests for layered effects.
Try allowing the stamina bonus only every other turn.
🗓 Day 8 — For Loops (Listing Things)
💡 No hard-coding — update the map, game UI updates automatically.
🗓 Day 9 — While Loops (Turn Engine)
💡 Controls the full game lifecycle.
🗓 Day 10 — Lists (Attacks, Monsters, Logs)
💡 Lists manage multiple objects and history.
🗓 Day 11 — Tuples & Sets
💡 Tuples = constants, Sets = unique membership + intersection logic.
🗓 Day 12 — Dictionaries (Structured Data)
💡 Dictionaries are your in-memory database.
🗓 Day 13 — Nested Structures (World + Combat)
💡 Set intersection makes weakness logic one line.
Core Gameplay Pieces
Movement
Items
Combat
Heal & Guard
💾 Full Code
Download the complete example on GitHub:
👉 Learn-Python-in-30-Days → Day 14 Tiny Dungeon
🧠 Challenges
| Challenge | Hint |
|---|---|
| Hard Mode | Reduce passive stamina regen to every other turn (use a turn counter). |
| Lock & Key | Require the tome to unlock the crypt. |
| Multi-Foe Room | Add two monsters to the crypt and loop their attacks. |
| Combo Attacks | Parse attack strike+bash and sum costs / damage. |
| ASCII Map | Use a nested list grid and redraw each turn. |
🏁 What You’ve Achieved
You’ve now combined:
-
Loops, logic, and data structures into a working text game
-
Deterministic combat and inventory systems
-
Reusable patterns for functions and refactoring (next week)
Next time, we’ll move into Week 3 which will cover Functions & Files:
During this time you’ll refactor this dungeon into smaller, cleaner functions and learn how to save / load your game data.
All example files for this series are available on my GitHub: Learn-Python-in-30-Days
You can see the full series here Learn Python in 30 Days series!
Hope you have enjoyed this post, thanks Matty
Comments
Post a Comment