A flexible, extensible Werewolf game engine for Python
Project description
WereWolf Engine
A flexible, extensible Werewolf (Mafia) game engine for Python.
Features
- 6 built‑in roles: Villager, Werewolf, Seer, Doctor, Witch, Hunter
- Plugin system for custom roles
- Full night/day cycle with priority and conflict resolution
- Voting system with majority & tie handling
- Event bus for UI integration
- Save/restore game state (to/from dict)
- 23+ tests covering all features
Installation
pip install werewolf-engine
Quick Example
from werewolf_engine import Game, GameConfig
config = GameConfig(role_counts={"villager": 3, "werewolf": 2, "seer": 1, "doctor": 1, "witch": 1, "hunter": 1})
game = Game(["Alice", "Bob", "Charlie", "Diana", "Eve", "Frank", "Grace", "Hank", "Ivy"], config)
game.start()
# Drive the game with your own UI (bot, web, CLI...)
while game.phase != Phase.END:
if game.phase == Phase.NIGHT:
actor = game.night_manager.current_actor
if actor:
targets = game.night_manager.get_available_targets(actor)
# get user choice, then:
game.night_action(actor.id, chosen_target.id)
Documentation
Full documentation is available in English and Persian:
Learn about roles, events, API reference, and how to contribute.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
werewolf_engine-0.1.0.tar.gz
(13.8 kB
view details)
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 werewolf_engine-0.1.0.tar.gz.
File metadata
- Download URL: werewolf_engine-0.1.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e511771540a5d60e451adfb958ac2fcc804dd221bbd237cd9139b78c35d73dc3
|
|
| MD5 |
cae726a32c207817d3f87af90940572a
|
|
| BLAKE2b-256 |
6751b93d94082be1e401a71c1af6eedec1705fbb10eac122d23407b17d7676ac
|
File details
Details for the file werewolf_engine-0.1.0-py3-none-any.whl.
File metadata
- Download URL: werewolf_engine-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a9df7ad3c9893c8242f06b98626a54ae1012bacc484db3d44eb027e64306555
|
|
| MD5 |
eef1164d29ade1b666d301230a964f8b
|
|
| BLAKE2b-256 |
fd4fd5e18768cea446cb2007565ed8d62de1acb0fc7b796e83256632594cb767
|