Python hidden-information chess engine for Berkeley-family Kriegspiel variants
Project description
kriegspiel
Python game engine for hidden-information Kriegspiel referee rules.
Current scope:
- Berkeley Kriegspiel
- Berkeley + Any
- Cincinnati
- Wild 16
The package models the referee, not a UI. You interact with it by asking questions as KriegspielMove objects and reading KriegspielAnswer results.
Install
pip install kriegspiel
Quick Start
import chess
from kriegspiel import KriegspielGame, KriegspielMove, QuestionAnnouncement
game = KriegspielGame()
question = KriegspielMove(
QuestionAnnouncement.COMMON,
chess.Move.from_uci("e2e4"),
)
answer = game.ask_for(question)
print(answer.main_announcement)
print(answer.special_announcement)
game.save_game("game.json")
loaded = KriegspielGame.load_game("game.json")
KriegspielGame() defaults to Berkeley + Any for backward compatibility. You can
still use BerkeleyGame explicitly as a compatibility wrapper, or pick a ruleset
with ruleset=....
Cincinnati and Wild 16 also have their own convenience entrypoints:
from kriegspiel import CincinnatiGame, Wild16Game
cincinnati = CincinnatiGame()
print(cincinnati.current_turn_has_pawn_capture)
wild16 = Wild16Game()
print(wild16.current_turn_pawn_tries)
Main Concepts
KriegspielGame: the neutral public entrypoint for the shared hidden-board engineBerkeleyGame: backward-compatible Berkeley-named wrapper overKriegspielGameCincinnatiGame: Cincinnati convenience entrypoint with publicNONSENSEand binary pawn-capture announcementsWild16Game: Wild 16 convenience entrypoint over the shared hidden-board engineKriegspielMove: a player question, either a normal move orASK_ANYKriegspielAnswer: the referee response, including move outcome, captures, special announcements, and variant-specific public metadata
Links
- PyPI: kriegspiel
- Issues: github.com/Kriegspiel/ks-game/issues
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
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 kriegspiel-1.4.2.tar.gz.
File metadata
- Download URL: kriegspiel-1.4.2.tar.gz
- Upload date:
- Size: 41.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb49380e3fcb415b2a2bedb115ca762552adf481bd3ce0ff816284b02ed64c2e
|
|
| MD5 |
257270667541c5c8359dd945c4c6b43b
|
|
| BLAKE2b-256 |
a145de199be254980b0e114e2412d35bf4c922aa33258ec0f4853de616428bdd
|
File details
Details for the file kriegspiel-1.4.2-py3-none-any.whl.
File metadata
- Download URL: kriegspiel-1.4.2-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e36735ac73f7ccd06cfffab8dcab1296956f70c184ed322bbbdd74eb67b47b9
|
|
| MD5 |
0af8d3996acdf665f5795463cda2355f
|
|
| BLAKE2b-256 |
d4e78b3d213669bdda8cbc5edb9def54f194918bb3139610ddc3070b4caad940
|