Skip to content
项目

bcollazo/catanatron has 447 GitHub stars and 157 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-22 01:24 UTC. Last push 2026-09-16.

这些数字如何统计

实测星标增长

24小时
0
7天
正在收集历史
15天
正在收集历史
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

关于

Settlers of Catan Bot Simulator and Strong AI Player

机器学习

README.md

原文

Catanatron

Coverage Status Documentation Status Discord Open In Colab

Catanatron is a high-performance simulator and strong AI player for Settlers of Catan. You can run thousands of games in the order of seconds. The goal is to find the strongest Settlers of Catan bot possible.

Get Started with the Full Documentation: https://docs.catanatron.com

Join our Discord: https://discord.gg/FgFmb75TWd!

Command Line Interface

Catanatron provides a catanatron-play CLI tool to run large scale simulations.

Installation

  1. Clone the repository:

    git clone [email protected]:bcollazo/catanatron.git
    cd catanatron/
    
  2. Create a virtual environment (requires Python 3.11 or higher)

    python -m venv venv
    source ./venv/bin/activate
    # ./venv/Scripts/Activate.ps1 (on windows)
    
  3. Install dependencies

    pip install -e .
    
  4. (Optional) Install developer and advanced dependencies

    pip install -e ".[web,gym,dev]"
    

Usage

Run simulations and generate datasets via the CLI:

catanatron-play --players=R,R,R,W --num=100

Generate datasets from the games to analyze:

catanatron-play --num 100 --output my-data-path/ --output-format json

See more examples at https://docs.catanatron.com.

Graphical User Interface

We provide Docker images so that you can watch, inspect, and play games against Catanatron via a web UI!

Installation

  1. Ensure you have Docker installed (https://docs.docker.com/engine/install/)

  2. Run the docker-compose.yaml in the root folder of the repo:

    docker compose up
    
  3. Visit http://localhost:3000 in your browser!

Python Library

You can also use catanatron package directly which provides a core implementation of the Settlers of Catan game logic.

from catanatron import Game, RandomPlayer, Color

# Play a simple 4v4 game
players = [
    RandomPlayer(Color.RED),
    RandomPlayer(Color.BLUE),
    RandomPlayer(Color.WHITE),
    RandomPlayer(Color.ORANGE),
]
game = Game(players)
print(game.play())  # returns winning color

See more at http://docs.catanatron.com

Gymnasium Interface

For Reinforcement Learning, catanatron provides an Open AI / Gymnasium Environment.

Install it with:

pip install -e .[gym]

and use it like:

import random
import gymnasium
import catanatron.gym

env = gymnasium.make("catanatron/Catanatron-v0")
observation, info = env.reset()
for _ in range(1000):
    # your agent here (this takes random actions)
    action = random.choice(info["valid_actions"])

    observation, reward, terminated, truncated, info = env.step(action)
    done = terminated or truncated
    if done:
        observation, info = env.reset()
env.close()

See more at: https://docs.catanatron.com

Documentation

Full documentation here: https://docs.catanatron.com

Contributing

To develop for Catanatron core logic, install the dev dependencies and use the following test suite:

pip install .[web,gym,dev]
coverage run --source=catanatron -m pytest tests/ && coverage report

See more at: https://docs.catanatron.com

Appendix

See the motivation of the project here: 5 Ways NOT to Build a Catan AI.

探索相关项目

加载中…