Skip to main content

A Python implementation of the Scoundrel roguelike card game

Project description

PyScoundrel ๐Ÿƒ

CI PyPI Python

A Python implementation of Scoundrel, a single-player roguelike card game by Zach Gage and Kurt Bieg.

Experience the thrill of dungeon crawling through a deck of cards with a modern, clean terminal interface!

๐ŸŽฎ Features

  • Full Scoundrel Implementation: Complete game mechanics including weapons, monsters, and health potions
  • Modern CLI Interface: Clean terminal UI powered by Rich with:
    • Rounded borders and clean tables
    • Integer-based menu system (1, 2, 3... 0 to quit)
    • Color-coded cards by type
    • Health percentage display
    • Damage calculations shown clearly
  • Fast Flow Gameplay: No pauses or confirmations - continuous action
  • Smart Choices: Only valid actions are displayed (no disabled options)
  • Configurable Dungeons: YAML-based card pool system - customize or create themed dungeons
  • Agent Support: Create automated players with custom strategies
  • Comprehensive Logging: Track every game event with JSON logs for analysis
    • Console logging for real-time monitoring
    • File logging with complete game state
    • Auto-generated filenames with timestamps
  • Reproducible Games: Random seed support for consistent playthroughs

๐Ÿ“ฆ Installation

From PyPI

pip install pyscoundrel

From source

git clone https://github.com/jeanmidevacc/pyscoundrel.git
cd pyscoundrel
pip install -e ".[dev]"

Dependencies

  • Python 3.10+
  • rich >= 13.0.0
  • pyyaml >= 6.0.0

๐ŸŽฏ Quick Start

Play the game

# Run with default settings
python -m pyscoundrel

# Use a specific random seed (for reproducible games)
python -m pyscoundrel --seed 42

# Skip title screen
python -m pyscoundrel --no-title

# Use a custom dungeon
python -m pyscoundrel --dungeon my_dungeon.yaml

Command-line options

--seed INT           # Random seed for reproducible games
--no-title           # Skip title screen
--dungeon PATH       # Path to custom dungeon YAML

๐ŸŽฒ How to Play

Game Rules

Scoundrel is played with a 44-card dungeon deck (26 monsters, 9 weapons, 9 potions).

Card Types:

  • Monsters: Deal damage equal to their value (2-14)
  • Weapons: Reduce monster damage. Important weapon rule: After killing a monster, the weapon can only be used on monsters โ‰ค last kill value
  • Health Potions: Restore health (max 20 HP). One per turn only

Gameplay:

  1. Draw 4 cards to form a Room
  2. Choose to avoid the room (cards go to bottom of deck) or face it
    • Cannot avoid two rooms in a row
  3. If facing the room, choose 3 of 4 cards to face (one carries over to next room)
  4. Handle each card:
    • Weapon: Equip it (discards old weapon)
    • Potion: Heal (max 20 HP, one per turn)
    • Monster: Fight barehanded OR with weapon (if available)

Winning/Losing:

  • Win: Clear the entire deck while staying alive
  • Lose: Health reaches 0
  • Quit: Press 0 anytime (counts as defeat)

Scoring:

  • Victory: Your remaining health
  • Defeat: Negative value = sum of remaining monster damage

๐Ÿฐ Dungeon Configuration

PyScoundrel uses a YAML-based dungeon system for complete card customization.

Default Dungeon

The default dungeon uses standard playing card names (Jโ™ฃ, 7โ™ฅ, Kโ™ , etc.) matching classic Scoundrel.

Custom Dungeons

Create your own themed dungeons:

# my_dungeon.yaml
version: "1.0"

cards:
  # Monsters
  - id: "Goblin"
    name: "Goblin"
    type: monster
    value: 3
    count: 4

  - id: "Dragon"
    name: "Dragon"
    type: monster
    value: 13
    count: 2

  # Weapons
  - id: "Sword"
    name: "Steel Sword"
    type: weapon
    value: 7
    count: 1

  # Potions
  - id: "Potion"
    name: "Healing Potion"
    type: health_potion
    value: 5
    count: 3

See DUNGEON_CONFIGURATION.md for full documentation.

๐Ÿ“š Documentation

๐Ÿ—๏ธ Package Structure

pyscoundrel/
โ”œโ”€โ”€ models/          # Core game entities
โ”‚   โ”œโ”€โ”€ card.py      # Card model (supports both legacy and dungeon formats)
โ”‚   โ”œโ”€โ”€ deck.py      # Deck management with dungeon support
โ”‚   โ”œโ”€โ”€ weapon.py    # Weapon with kill history tracking
โ”‚   โ”œโ”€โ”€ player.py    # Player state (health, equipped weapon)
โ”‚   โ””โ”€โ”€ room.py      # Room with 4 cards
โ”œโ”€โ”€ game/            # Game logic
โ”‚   โ”œโ”€โ”€ state.py     # GameState and GamePhase
โ”‚   โ”œโ”€โ”€ engine.py    # Core game logic and rules
โ”‚   โ””โ”€โ”€ actions.py   # Player actions and results
โ”œโ”€โ”€ dungeon/         # Dungeon card pool system
โ”‚   โ”œโ”€โ”€ card_pool.py # Dungeon loader and validator
โ”‚   โ””โ”€โ”€ default_dungeon.yaml  # Default card pool
โ”œโ”€โ”€ ui/              # Rich-based terminal UI
โ”‚   โ”œโ”€โ”€ renderer.py  # Game renderer
โ”‚   โ”œโ”€โ”€ theme.py     # Color theme
โ”‚   โ””โ”€โ”€ input.py     # Input handling
โ””โ”€โ”€ config.py        # Game configuration

๐Ÿ’ป Programmatic Usage

Use PyScoundrel as a library:

from pyscoundrel.game.engine import GameEngine
from pyscoundrel.dungeon import Dungeon
from pyscoundrel.config import GameConfig

# Create game with default dungeon
engine = GameEngine(seed=42)
engine.start_game()

# Or use a custom dungeon
dungeon = Dungeon(config_path="my_dungeon.yaml")
engine = GameEngine(dungeon=dungeon, seed=42)

# Game loop
while not engine.is_game_over:
    result = engine.draw_room()
    # Handle room...
    result = engine.face_card(0)
    # Handle card...

# Get final score
print(f"Victory: {engine.state.victory}")
print(f"Final Score: {engine.state.score}")

๐ŸŽจ UI Features

Modern Interface:

  • Numbered menu system (1-5 for actions, 0 to quit)
  • Rounded borders and clean tables
  • Color-coded card types
  • Health bar with percentage
  • Weapon status with restrictions

Smart Display:

  • Monster combat options expanded in menu (barehanded + weapon as separate choices)
  • Only valid choices shown (no grayed-out disabled options)
  • Immediate feedback - no pauses between actions

Fast Flow:

  • No "Press Enter to continue" prompts
  • No quit confirmations
  • Continuous gameplay

๐Ÿ“ License

This implementation is released under the MIT License. The original Scoundrel game is ยฉ 2011 Zach Gage and Kurt Bieg.

๐Ÿ™ Credits

  • Original Game Design: Zach Gage and Kurt Bieg
  • Python Implementation: PyScoundrel Contributors
  • UI Library: Rich by Will McGugan

๐Ÿค Contributing

Contributions are welcome! This package focuses on clean game logic implementation with a modern CLI experience.


Enjoy dungeon crawling through a deck of cards! ๐Ÿƒโš”๏ธ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyscoundrel-0.1.1.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyscoundrel-0.1.1-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file pyscoundrel-0.1.1.tar.gz.

File metadata

  • Download URL: pyscoundrel-0.1.1.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyscoundrel-0.1.1.tar.gz
Algorithm Hash digest
SHA256 091b7a610659013bdfe09e5e10f26c2d50479d5d9569033548122a06972857ed
MD5 37bad0d6460fb5402e1bfa38c66754a1
BLAKE2b-256 f1c6b3912ae4b0dbbc13928068c84a6fb76448cc03943e8f7ee94ef459d79ab6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyscoundrel-0.1.1.tar.gz:

Publisher: release.yml on jeanmidevacc/pyscoundrel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyscoundrel-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyscoundrel-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyscoundrel-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a268816d00d041681ffd06f5673e416c92e3bf2c194383afd41f47320536df58
MD5 74fec6265a92dc75009a441a35f6c0bd
BLAKE2b-256 7967c38df7dd5510bd8f46f8f30041183d441ab496b673073cf74a4594656255

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyscoundrel-0.1.1-py3-none-any.whl:

Publisher: release.yml on jeanmidevacc/pyscoundrel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page