Python Lesson 2.3 — Cave Adventure

LessonsPython → Lesson 2.3
Python

Cave Adventure

“You are in a dark cave. Your choices matter. Tension. Fun.”

⏱ About 15 minutes 🛠 Python + IDLE ⭐ Lesson 3 of 3

What you will have

A choice-based text adventure where you wake up in a dark cave and must choose your path — treasure or dragon.

Three tunnels. Three different outcomes. You can keep playing after winning or losing without restarting.


Video walkthrough

Prefer to watch? Follow along with the full video.

Watch Greg build the Cave Adventure live — copying the prompt, pasting into ChatGPT, running it in IDLE, exploring all three tunnels, and making the Vibe Tweak. Pause and rewind as many times as you need.

Enjoying the videos? Subscribe on YouTube for every new lesson →


Your prompt

Copy this. Paste it into your AI. Hit Enter.

📋 Your Prompt — Copy Everything Below
Write a simple text adventure game in Python. Scenario: you wake up in a dark cave. You see three tunnels: left, right, and straight ahead. If you go left, you find treasure and win. If you go right, a dragon wakes up and you lose. If you go straight, you find a locked door — add a creative third outcome. Allow the player to keep playing after winning or losing without restarting. Make the descriptions atmospheric and fun.
✅ Copied! Now paste it into your AI.

What to do after

Follow these steps exactly.

1
Copy all the code from your AI
Select all and copy.
2
Open IDLE → File → New File
A blank editor window will open.
3
Paste and save as cave.py
Ctrl+V → File → Save As → cave.py.
4
Press F5 and explore
Type your choices and hit Enter. Try all three tunnels.

🛠️ Didn’t work?

Don’t panic. Here’s exactly what to do:

1 Copy the error from the IDLE window
2 Go back to your AI chat
3 Say: “This didn’t work. Here’s the error: [paste it]. Please fix it.”

Vibe Tweak

Change the story.

Open cave.py in IDLE. Find the losing message about the dragon. Change it to something funny. Save and press F5.

You just edited the narrative of a game. That’s writing and coding at the same time.


Extra Credit

Want to go further?

📋 Extra Credit Prompt
Add an inventory system to the cave adventure. At the start, give the player a torch. Add a fourth tunnel that is normally deadly — but if the player has the torch, they survive and find a secret room with double the treasure.
✅ Copied!

Reflection

Python complete. Think about this.

“Did you try all three tunnels? How did it feel to change the story just by describing it to the AI? You now have a game with a story that only you wrote.”

Python Complete! What’s next?
Keep the vibe going — pick your next subject
All subjects are live and ready. Pick anything that looks interesting.
See All Lessons →
Greg the Vibe Coder · gregthevibecoder.com 18 lessons · No account required