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.0.tar.gz (5.0 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.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scoundrel-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 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.0.tar.gz
Algorithm Hash digest
SHA256 7ed88f1335e0673685cb4e98fd4b982c4427f04a4553daab43d95ff005507a3f
MD5 118b0d6bf3ed4450ef1c64e956b2397e
BLAKE2b-256 e98a264d3fd09a4265509d3e775c52807edb0308b10c1e36899d771f5cf1e2c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scoundrel-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3585d937aaef43d6ec95a1e13415d9960102f462e5bd2df7aabc44eb01220231
MD5 ec7c7a9ee3d567c504e1e108d80b542c
BLAKE2b-256 dfd51b3b98d445f68f153fd1a3a1f2f2c911aeb59fa57868d59dba888ac6fcb9

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