Skip to main content

A Python implementation of the Scoundrel card game

Project description

Scoundrel Banner

A Python implementation of the Scoundrel card game

Python Platform License Code style: black Version


📋 Table of Contents


🎮 The Game

Scoundrel is a dungeon-crawling card game where players navigate through rooms, collect cards, and battle monsters.

🎯 Playing the Game

play [--seed SEED]

Play interactively in the terminal. Use --seed for deterministic deck shuffling (same seed = same game sequence).


🚀 Quick Start

# Clone the repository
git clone https://github.com/Lizzard1123/scoundrel.git
cd scoundrel

# Create conda environment
conda env create -f environment.yml
conda activate scoundrel

# Install package
pip install -e .

# Play the game
play

⚙️ Setup

Using Conda (Recommended)

conda env create -f environment.yml
conda activate scoundrel
pip install -e .

🤖 Agent Approaches

This implementation includes two AI agent approaches for playing Scoundrel:

🌳 MCTS Agent

Monte Carlo Tree Search agent with parallelization support for high-performance gameplay.

Features:

  • ⚡ Parallel simulation workers
  • 🧠 Transposition table caching
  • 📊 Performance visualization tools
  • 🎯 Configurable exploration parameters

Console Scripts:

Command Description
mcts Watch the MCTS agent play interactively
mcts-eval Evaluate MCTS agent performance
mcts-plot Visualize MCTS episode performance

Usage Examples:

# Interactive gameplay
mcts --num-simulations 1000000 --num-workers 8

# Performance evaluation
mcts-eval --num-games 10 --verbose

# Episode visualization
mcts-plot --num-simulations 1000000 --batch 5 --confidence

MCTS Interactive Visualizer

Interactive MCTS visualizer showing real-time gameplay

MCTS Action Outlook

Average outlook of the action picked at each turn

MCTS Batch Variability

MCTS performance variability across multiple runs (6 out of 10 runs won)

🎯 MCTS Data Collection (AlphaGo Style)

MCTS data collection pipeline for training AlphaGo-style neural network agents with supervised learning from expert gameplay.

MCTS Data Distribution

MCTS data collection showing game statistics and performance distribution

Data Collection Results:

Games: 5041

Statistics:
  Wins: 1316 (26.11%)
  Average score: -21.45
  Best score: 30
  Worst score: -188
  Average turns per game: 42.8
  Total turns: 215803

🧠 RL Agent

Reinforcement learning agent using a Transformer-based architecture with PPO training.

Features:

  • 🔄 Transformer encoder for sequence planning
  • 🎯 MLP for immediate tactical decisions
  • 📈 TensorBoard integration
  • 💾 Checkpoint management

Training:

cd scoundrel/rl/transformer_mlp/scripts
./train.sh

🛠️ Development

Running Tests

pytest

Code Formatting

black .
isort .

Project Structure

scoundrel/
├── game/          # Core game logic
├── models/        # Game state models
├── rl/            # AI agents
│   ├── mcts/      # MCTS implementation
│   └── transformer_mlp/  # RL agent
└── ui/            # Terminal UI

Made with ❤️ for card game enthusiasts

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

scoundrel-0.1.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

scoundrel-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scoundrel-0.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for scoundrel-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5f29fb4869d8b6caa7025c619fe2147de60eec04310b2cec639d199cad49e019
MD5 61ba99fe7d1d09f70a5129f3583b0300
BLAKE2b-256 373d4a0debfaeb4f80710628ffb9d263a7ee8b7fd4216248dd0c2be4f7928d4c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scoundrel-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for scoundrel-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e72773808e7db4375e63c51e03d0aa13d6b956476baf8d54bf5ffb360aa5c32
MD5 a8d1f745fc6512ff879a615b3f68c1ec
BLAKE2b-256 b86c87857888a36851d9cd93603b819504f0966bdacf471eab742b9ace4dbaae

See more details on using hashes here.

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