Skip to main content

Python Quoridor game engine with Gym environment for RL

Project description

Claude Code Review

🧠 Quoridor-RL: A Multi-Agent RL Environment for the Quoridor Board Game

Quoridor-RL is a Python-based simulation environment for the Quoridor board game, compatible with the Gymnasium API and multi-agent RL training using Ray RLlib. It also includes a 3D interactive web viewer built with Three.js, and supports human interaction, imitation learning, and deployment on Hugging Face Spaces.

Quoridor Board

✨ Features

  • ✅ Fully rule-compliant 2- and 4-player Quoridor engine
  • ♻️ Multi-agent training support (Ray RLlib)
  • 🎮 Human-agent interaction mode
  • 📈 Episode logging for imitation learning
  • 🧠 Gymnasium-compatible environment
  • 🌐 3D visualization in the browser (Three.js)
  • 🚀 Hugging Face Space ready

📦 Installation

Python Game Engine

pip install quoridor-env

JavaScript Viewer

cd web-viewer/
npm install
npm run dev

🧪 Quick Start: Training with Ray RLlib

from ray.rllib.algorithms.ppo import PPOConfig
from quoridor.env import QuoridorEnv

config = PPOConfig().environment(env=QuoridorEnv, env_config={...})
algo = config.build()
algo.train()
See training_examples/ for full MARL setups.

🌍 Web Viewer The web UI is built with Three.js and supports:

  • Live replay of RL episodes
  • Human-vs-agent gameplay
  • Drag-and-drop wall placement
  • API polling or WebSocket update

Launch

cd web-viewer/
npm run dev

📊 Observation & Action Spaces Observation Shape: (C, 9, 9) Channels:

  • Player positions
  • Opponent positions
  • Goal rows
  • Horizontal/vertical walls

Action Discrete:

  • 0–3: move in cardinal directions
  • 4–N: place wall at encoded location and orientation

See docs/observation_action.md for details.

🧠 Imitation Learning Support Episodes are logged to JSONL or .npz with:

  • observations, actions, rewards, next_observations, dones

Compatible with HumanCompatibleAI/imitation:

imitation-train expert_demos.npz --algo=bc

🚀 Hugging Face Space You can deploy the environment and viewer together on Hugging Face Spaces.

Example layout:

huggingface-space/
├── app.py     # Gradio or Flask API server
├── assets/    # Quoridor model data
└── web/       # Built JS assets
📜 License
MIT License. See `LICENSE`.

🤝 Contributing Pull requests and feature suggestions are welcome! Please open an issue to discuss major changes first.

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

quoridor_env-0.2.2.tar.gz (47.7 kB view details)

Uploaded Source

Built Distribution

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

quoridor_env-0.2.2-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file quoridor_env-0.2.2.tar.gz.

File metadata

  • Download URL: quoridor_env-0.2.2.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for quoridor_env-0.2.2.tar.gz
Algorithm Hash digest
SHA256 5f7f57aa61104e3c4e6edabdfa9d3837e0cfd5acd25d585e71ef4081ac32960d
MD5 58eda1229b3a3fa135c08899ec9d70cd
BLAKE2b-256 d446db70b8f96500126be44f433ca7798f81c1b4e23d3ebd366a5446f4ae7f76

See more details on using hashes here.

File details

Details for the file quoridor_env-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: quoridor_env-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for quoridor_env-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1dc19ee21a88a5fd81d5168c491781351044e66bdfac5b01ab1ede2e81157e6b
MD5 a7da1b46b0fceac6b4be521855163ed6
BLAKE2b-256 616f37a64f0ccc1b16fbe5625cd8c5a2b4f1c5a08c4e3302bc868f6182049465

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