Files
Tirsvad faa96bd728
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 5s
Add project infrastructure: project config, license, README, tests, and
example env file
2026-10-04 10:08:44 +08:00

2.3 KiB

🚀 Treasure Island

A beginner-friendly Python "Choose Your Own Adventure" text game where your choices decide whether you find the treasure.

📚 Table of Contents

🧭 Overview

You start at a crossroad and pick your way through the story using if / elif / else logic. Answers are lowercased and trimmed, so Left and LEFT work too, and invalid answers are asked again.

crossroad: left or right
  right -> Game Over (hole)
  left  -> lake: wait or swim
            swim -> Game Over (trout)
            wait -> island: red, yellow or blue door
                      red    -> Game Over (fire)
                      blue   -> Game Over (beasts)
                      yellow -> You Win!

Only one path wins. Feel free to rewrite the story in src/treasure_island/game.py. It is part of Udemy's 100 Days of Code: The Complete Python Pro Bootcamp and has no runtime dependencies.

📋 Requirements

  • Python 3.13 or newer
  • pytest (only for running the tests)

🛠️ Setup

Create and activate a local virtual environment in the project root:

python -m venv .venv

Activate it:

  • Windows (PowerShell): .venv\Scripts\Activate.ps1
  • Windows (cmd): .venv\Scripts\activate.bat
  • Git Bash on Windows: source .venv/Scripts/activate
  • macOS / Linux: source .venv/bin/activate

Install the project with the test tools:

pip install -e ".[dev]"

Leave the environment with deactivate.

Optional: copy .env.example to .env and fill in GIT_TOKEN. It is only used for repository maintenance (such as setting the repository description and topics), never to run the game. .env is git-ignored.

▶️ Run

python -m treasure_island

or, after installing:

treasure-island

🧪 Tests

pytest

📄 License

Released under the GNU Affero General Public License v3.0 (AGPL-3.0-or-later).