Jarian 7ec5ae1664 fix: batch fix all 14 issues
- Fix memory test infinite loop (#1, #3) — add max iterations counter
- Fix os.system command injection (#2, #4) — use subprocess with list args
- Fix demon difficulty scaling (#5) — scale health/damage per cycle
- Fix relative import (#6) — absolute imports with sys.path fallback
- Fix normalize_text non-ASCII (#7) — use isalpha/isdigit instead of isalnum
- Fix calculate_similarity word order (#8) — set-based intersection
- Add CMD to Dockerfile (#9)
- Remove test files from prod image (#10) — .dockerignore + strip tests COPY
- Fix test class import (#11) — lazy import in test methods
- Fix pyproject.toml duplicate pytest (#12) — move to dev optional deps
- Add resource limits to compose (#13)
- Fix verses.json quality (#14) — fix garbled verse text
2026-07-05 22:22:41 +00:00
2026-05-09 11:55:14 -05:00
2026-05-09 11:55:14 -05:00
2026-07-05 22:22:41 +00:00
2026-07-05 22:22:41 +00:00
2026-07-05 22:22:41 +00:00
2026-05-09 11:55:14 -05:00
2026-05-09 11:55:14 -05:00
2026-07-05 22:22:41 +00:00
2026-07-05 22:22:41 +00:00
2026-05-09 11:55:14 -05:00
2026-07-05 22:22:41 +00:00
2026-05-09 11:54:32 -05:00
2026-05-09 11:55:14 -05:00
2026-07-05 22:22:41 +00:00

Arcane Purge

A text-based exorcist game where Bible verses are your weapons against demonic forces. Type verses from Scripture to cast spells, pass memory tests to defeat demons, and unlock progressively more powerful verses as you advance.

What It Does

Arcane Purge is a terminal-based game that combines Scripture memorization with demon-slaying gameplay:

  • Verse Casting - Select a verse, then type it exactly to deal damage to demons. Verses matching a demon's weakness deal double damage.
  • Memory Tests - After a successful cast, recall the same verse without looking. Passing delivers a powerful finishing strike.
  • Progression - Start with 4 easy verses. Defeating demons unlocks harder verses and new categories. After 5 demons, Memory Mode activates.
  • Scoring - Points awarded for correct casts, speed bonuses, memory test success, and demon defeats. Deducted for failures.
  • Hint System - Press H at any input to see the first letter of each word.

Setup and Dependencies

Requirements

  • Python 3.11+
  • Astral UV (for dependency management)
  • Docker (for containerized deployment)

Install with UV

uv sync

This installs all dependencies listed in pyproject.toml (currently pytest for testing).

Install with pip

pip install pytest

How to Run

cd docker
docker compose up --build

This builds the game container and starts it in interactive mode. The game runs inside the container with a TTY attached for input.

To run tests inside the container:

cd docker
docker compose run game python -m pytest tests -v

Direct Python

python main.py

Running Tests

python -m pytest tests/ -v

The test suite includes 34 tests covering data loading, text normalization, verse filtering, similarity matching, hint generation, and game initialization.

Project Structure

exorcist-game/
├── .dockerignore              # Docker build exclusions
├── .env.example               # Environment variable template
├── .hadolint.yaml             # Dockerfile linting config
├── pyproject.toml             # Project metadata and dependencies
├── uv.lock                    # UV dependency lock file
├── verses.json                # Bible verse data (12 verses, 5 categories)
├── data.py                    # Verse loading, filtering, text normalization
├── main.py                    # Game engine: encounters, casting, scoring
├── docker/
│   ├── docker-compose.yml     # Service orchestration
│   └── Dockerfile             # Multi-stage container build
├── tests/
│   ├── test_data.py           # Data module tests (21 tests)
│   └── test_main.py           # Game logic tests (13 tests)
└── README.md                  # This file

Key Modules

File Purpose
main.py Game loop, demon encounters, verse casting, memory tests, scoring, progression
data.py Verse data loading from JSON, category/difficulty filtering, text normalization
verses.json 12 verses across 5 categories (Binding, Healing, Exorcism, Protection, Judgment)
tests/ Validation suite ensuring data integrity and game logic correctness

Configuration and Environment Variables

Environment Variables

Copy .env.example to .env and configure:

PYTHON_VERSION=3.12-slim    # Python version for Docker base image
GAME_PORT=8080              # (Reserved for future web interface)

The game runs without environment variables configured. All game data is embedded in verses.json.

Verse Data Format

Each verse in verses.json follows this structure:

{
    "id": "binding_001",
    "text": "Full verse text here.",
    "category": "Binding",
    "difficulty": 1,
    "reference": "Luke 10:19"
}

Adding Verses

Append new verse objects to the verses array in verses.json. Difficulty must be 1-5.

Adding Demons

Edit the DEMONS list in main.py:

{"name": "Demon Name", "health": 100, "weaknesses": ["Binding", "Exorcism"], "damage": 20}

Code Quality

The project uses Ruff for linting and Hadolint for Dockerfile validation:

ruff format .
ruff check --fix .
hadolint docker/Dockerfile

All checks must pass before building the container.

Description
Text-based exorcist game (Arcane Purge) — Bible verses as spell mechanics against weakness-based demons. Working prototype.
Readme 132 KiB
Languages
Python 98.2%
Dockerfile 1.8%