A Python implementation of the Scoundrel roguelike card game
Project description
PyScoundrel ๐
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 source
git clone https://github.com/yourusername/pyscoundrel.git
cd pyscoundrel
pip install -r requirements.txt
Dependencies
- Python 3.8+
- 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:
- Draw 4 cards to form a Room
- Choose to avoid the room (cards go to bottom of deck) or face it
- Cannot avoid two rooms in a row
- If facing the room, choose 3 of 4 cards to face (one carries over to next room)
- 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
- Quick Start Guide - Get playing in 2 minutes
- Dungeon Configuration - Customize your card pool with YAML
- Logging Guide - Track and analyze game events
- Agent Development - Create automated players
๐๏ธ 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyscoundrel-0.1.0.tar.gz.
File metadata
- Download URL: pyscoundrel-0.1.0.tar.gz
- Upload date:
- Size: 31.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c8e46e69a40ed1cd3e34f90132eecdf04d31d1f9bc4b087419fe6b21a2552a7
|
|
| MD5 |
59312005f1d55da66e870f9eb343c8a4
|
|
| BLAKE2b-256 |
4275fdd629dacfec735890e19795fb81ac876bc4feb8b185ec3c0f7a8b873d3f
|
File details
Details for the file pyscoundrel-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyscoundrel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 36.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc54f4d96f2186c0dd454889d2e2f62229ffbc578f5f4062e59a373c6edfe242
|
|
| MD5 |
3df335d1398b815c25d3dbd2374ff099
|
|
| BLAKE2b-256 |
ebe4ec918e8705185448f7526548b8e6e6f180c8565412bb72691009fa423e83
|