An epic, terminal-based math RPG โ with AI-powered infinite adventures, ASCII scene art, and full bilingual support.
Quantum Odyssey is a story-driven, RPG-style math game that runs entirely in your terminal. You play as a Numerist โ a math hero tasked with defeating Lord Miscalculus, who has stolen the Great Equations and thrown the Numeriverse into chaos.
The game features:
- A full story campaign (Chapter 1: The Arithmos Plains) with 5 zones, NPC dialogue, combat, and a final boss
- 7 unique minigames (Math Sprint, Rocket Launch, Bridge Builder, and more)
- An AI-powered infinite quest mode that generates endless story adventures + math challenges on any theme you choose
- Full Indonesian / English bilingual support that switches every UI string and all AI prompts
- ASCII art scene reveals, animated character portraits, and enemy flash effects โ all in the terminal
- A built-in offline story engine so the AI quest works beautifully even without an API key
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ๏ธ ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท โ๏ธ โ
โ โ
โ โฟโฟโฟโฟ โก+โข=? โฟโฟโฟโฟโฟ โ
โ โ
โ ๐ฟ๐ฟ๐ฟ ๐ธ ๐ฟ๐ฟ โฆ ๐ฟ๐ฟ๐ฟ ๐ธ ๐ฟ๐ฟ๐ฟ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโ The Awakening Meadow โโ Glowing Math Glyphs Float... โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
(\ /)
( o.o ) Professor Figaro
_( > < )_ Red Fox ยท Arithmos Scholar
/ ๐ญ [ ]/
(___||___|___)
[Professor Figaro]: "Greetings, young traveler! I am Professor Figaro."
- 5 handcrafted zones per chapter, each with its own environment, NPCs, and narrative puzzles
- Live character portraits in ASCII art for every major character (Professor Figaro, Mayor Tally, Miner Max, Oracle Sera, Lord Miscalculus, and more)
- Animated scene reveals โ zones wipe in line-by-line like a cinematic pan
- Layered weather ambients โ sunshine, lightning storms, cave stalactites, starfields, neon grids
- 3-phase boss battle against Lord Miscalculus, with escalating difficulty and HP
- Combat system with skill-based damage modifiers and a Logic Shield mechanic
- Describe any adventure theme (e.g. "a starship escaping a black hole", "a wizard climbing a dragon tower", "a cyber-hacker infiltrating a neon megacorp")
- Gemini AI generates story rooms, NPC dialogue, and custom math puzzles tailored to your chosen difficulty
- Offline fallback: if no API key is configured, the built-in narrative engine provides 20+ hand-written rooms across 4 themed worlds (Space, Dungeon, Cyber, Wizard) in both languages โ the game never goes blank
- Room banners escalate dramatically as you go deeper (๐ Room 1 โ ๐ Room 5 โ ๐ Room 7)
- Persistent story history: your choices in earlier rooms influence future AI prompts
| Minigame | Description |
|---|---|
| ๐ Math Sprint | Answer as many problems as you can in 60 seconds. Streak combos up to 5ร multiplier |
| ๐ Rocket Launch | Solve problems to fuel a rocket stage-by-stage and reach orbit |
| ๐๏ธ Bridge Builder | Choose correct answers to place structural segments |
| ๐ฅท Number Ninja | Rapid-fire problems in a ninja-training style |
| ๐ต Pattern DJ | Identify the missing number in sequences |
| โญ Star Collector | Navigate a path by solving arithmetic gates |
| ๐ Treasure Chest | Riddle-based puzzles unlock chests of gold |
The game supports randomised, curriculum-appropriate problems across:
| Topic | Examples |
|---|---|
| Arithmetic | Mental math, word problems, estimation |
| Pre-Algebra | Expressions, order of operations |
| Algebra | Linear equations, quadratics, systems |
| Number Theory | Primes, GCD/LCM, divisibility |
| Geometry | Area, perimeter, angles, triangles |
| Probability & Statistics | Mean, median, probability fractions |
| Calculus | Derivatives, integrals (Advanced+) |
| Trigonometry | Sin/cos/tan, identities |
| Matrix & Linear Algebra | Matrix ops, determinants |
| Discrete Mathematics | Combinations, logic, sequences |
| Mixed | All of the above, randomly selected |
Difficulty scales from Beginner โ Intermediate โ Advanced โ Expert โ Master โ Olympiad/Insane.
- Switch between English and Indonesian in Settings โ takes effect immediately, no restart needed
- All menu labels, HUD text, NPC dialogue templates, and AI quest prompts switch language
- The Gemini AI is prompted to respond entirely in the chosen language
- Your Gemini API key is stored in
saves/config.jsononly on your local machine - It is never committed to git (protected by
.gitignore) - Alternatively, set the
GEMINI_API_KEYenvironment variable โ the game reads it automatically with priority over the file
- 20 achievements with XP rewards
- 4-skill tree: Mental Math, Logic Shield, Hint Oracle, Quick Calc
- Gold shop with potions and upgrades
- Daily play streak tracking
- Save/load with 3 slots + export/import Base64 save codes (portable across devices)
- Python 3.10 or higher (uses
match,|type unions) - No third-party packages required โ pure standard library
- A terminal that supports ANSI escape codes (Linux, macOS, Windows Terminal)
- (Optional) A free Google Gemini API key for the AI quest mode
You can install the game directly from GitHub and run it from anywhere in your terminal:
pip install git+https://github.com/Axzo001/MathGame.git๐ก On Modern Linux (PEP 668 "externally-managed-environment" error): If your system blocks global installations, you can safely install it via
pipx:pipx install git+https://github.com/Axzo001/MathGame.gitOr install it using the system override flag (which is completely safe here as this project has zero external dependencies):
pip install --break-system-packages git+https://github.com/Axzo001/MathGame.git
Once installed, play the game simply by running:
quantum-odysseyNote: In this mode, your configurations and game saves are stored safely inside your user home directory at ~/.quantum-odyssey/.
If you want to run it from the cloned repository:
-
Clone the repository:
git clone https://github.com/Axzo001/MathGame.git cd MathGame -
Configure your API Key: Copy the example config:
cp saves/config.example.json saves/config.json
Open
saves/config.jsonand fill in your Gemini API key:{ "gemini_api_key": "YOUR_API_KEY_HERE", "gemini_model": "gemini-1.5-flash", "language": "en", "math_material": "Mixed", "target_level": "Middle School", "ai_difficulty": "intermediate" } -
Run the game:
python -m quantum_odyssey
MathGame/
โ
โโโ pyproject.toml # Build system & CLI entrypoint configuration
โโโ LICENSE # MIT License
โโโ README.md # Project documentation
โ
โโโ saves/ # Local developer saves (git-ignored)
โ โโโ config.example.json # Example configuration file
โ
โโโ quantum_odyssey/ # Package directory
โโโ __init__.py # Package initialization
โโโ __main__.py # CLI entry point runner
โโโ main.py # Main menu and loop orchestrator
โ
โโโ engine/ # Core game systems
โ โโโ display.py # ANSI colors, typewriter, ASCII art renderer
โ โโโ game_state.py # Player state, save/load, XP/level system
โ โโโ input_handler.py # Arrow-key menus, answer validation, stats viewer
โ โโโ ai_engine.py # Gemini API connection, query packaging
โ โโโ translation.py # EN/ID translation with cached config I/O
โ โโโ scene_art.py # ASCII art library (zones, characters, weather)
โ โโโ progression.py # Achievements, skill tree, score bonuses
โ โโโ combat.py # Battle system, enemy stats, turn logic
โ โโโ sound.py # Sound effects via system audio (optional)
โ
โโโ story/ # Narrative content
โ โโโ chapter1_arithmos.py # Chapter 1: 5 zones + boss (full story)
โ โโโ story_manager.py # Shop, events, hub, minigame arcade, rewards
โ โโโ ai_quest.py # AI infinite quest orchestrator
โ โโโ offline_narrative.py # Built-in story rooms (works without API key)
โ
โโโ puzzles/ # Math puzzle generation
โ โโโ puzzle_factory.py # Procedural puzzle factory (all topics + difficulties)
โ โโโ ...
โ
โโโ minigames/ # 7 standalone minigames
โ โโโ math_sprint.py
โ โโโ rocket_launch.py
โ โโโ bridge_builder.py
โ โโโ ...
โ
โโโ data/ # Static data files
โ โโโ achievements.json
โ โโโ shop_items.json
โ
โโโ sounds/ # Optional WAV sound effects
You can change all settings without touching any files directly. From the main menu, select โ๏ธ Settings & Gemini AI:
| Setting | Options |
|---|---|
| Language | English / Indonesian |
| Math Material | 11 topics or Mixed |
| Grade Level | Elementary / Middle / High School / University+Olympiad |
| AI Difficulty | Beginner โ Olympiad/Insane |
| API Key | Enter and test your Gemini key |
| Model | Switch between Gemini model versions |
Pull requests are welcome! A few notes:
- Keep the zero external dependencies design โ standard library only
- All user-facing strings should be wrapped in
tr()fromengine/translation.py - Add new math topics to
puzzles/puzzle_factory.pyandengine/translation.py - New story chapters go in
story/and should follow the zone function pattern inchapter1_arithmos.py - New scene art goes in
engine/scene_art.pyunder_SCENESor_CHARACTERS
MIT License โ see LICENSE for details.
May your combo streak never break.