Tactical Terminal Combat Simulator
A state-driven, turn-based combat game built entirely in Python — no libraries, no dependencies.
Tactical Terminal Combat Simulator is a 1v1 turn-based battle game that runs directly in your terminal. It was built as a hands-on exercise in core software engineering patterns — specifically around state management, modular logic routing, and rule-based AI decision-making.
No game engines. No third-party libraries. Just Python.
| Layer | Technology |
|---|---|
| Language | Python 3.x |
| Dependencies | None (standard library only) |
| Interface | Terminal / CLI |
The codebase is structured around scalable design patterns rather than brittle nested conditionals:
- State Management — Entity stats (HP, Stamina, Armor, Potions, Defense) are stored in Python dictionaries, enabling clean and predictable state mutations across the game loop.
- DRY Logic Routing — All combat math (RNG hit checks, armor reduction, status resets) is centralized in a single
execute_action()function, eliminating code duplication across attack types. - Conditional AI — The enemy evaluates its own resource thresholds each turn (HP and stamina) to decide whether to attack, defend, or heal — no hardcoded sequences.
- Config-Driven Difficulty — Difficulty levels are defined in a configuration dictionary with
.get()fallbacks, avoiding cascading if/else chains and protecting against invalid input.
A resource management duel — knowing when to attack matters as much as how hard you hit.
| # | Action | Description |
|---|---|---|
| 1 | Light Attack | 90% hit chance · Low damage · Recovers 5 stamina |
| 2 | Heavy Attack | 50% hit chance · High damage · Costs 15 stamina |
| 3 | Defend & Rest | Skips attack · Recovers 20 stamina · Halves next incoming hit |
| 4 | Heal | Consumes a potion · Restores 30 HP · Capped at max health |
Requirement: Python 3.x — nothing else needed.
# 1. Clone the repository
git clone https://github.com/your-username/your-repo-name.git
# 2. Navigate into the project directory
cd your-repo-name
# 3. Run the game
python game.py- OOP Refactor — Migrate dictionary-based state into Python classes (
Character,Player,Enemy) - UI Decoupling — Separate terminal output from the core logic engine to prep for a potential web frontend