Skip to main content

kriegspiel

PyPI version

Python game engine for hidden-information Kriegspiel referee rules.

You can try the rules in a live game at kriegspiel.org.

Current scope:

  • Berkeley Kriegspiel
  • Berkeley + Any
  • Cincinnati
  • English
  • RAND
  • Wild 16
  • Dutch / Can-I
  • CrazyKrieg

The package models the referee, not a UI. You interact with it by asking questions as KriegspielMove objects and reading KriegspielAnswer results.

Install

Supports Python 3.11, 3.12, 3.13, 3.14, and 3.15. The complete test suite and package builds are checked on every supported Python version.

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, CrazyKrieg, Dutch, English, RAND, and Wild 16 also have their own convenience entrypoints:

from kriegspiel import CincinnatiGame, CrazyKriegGame, DutchGame, EnglishGame, RandGame, Wild16Game

cincinnati = CincinnatiGame()
print(cincinnati.current_turn_has_pawn_capture)

crazykrieg = CrazyKriegGame()
print(crazykrieg.public_reserve_summary)

dutch = DutchGame()
print(dutch.can_i_state.value)

english = EnglishGame()
print(english.any_rule)

rand = RandGame()
print(rand.current_turn_pawn_try_squares)

wild16 = Wild16Game()
print(wild16.current_turn_pawn_tries)

Main Concepts

  • KriegspielGame: the neutral public entrypoint for the shared hidden-board engine
  • BerkeleyGame: backward-compatible Berkeley-named wrapper over KriegspielGame
  • CincinnatiGame: Cincinnati convenience entrypoint with public NONSENSE and binary pawn-capture announcements
  • CrazyKriegGame: Crazyhouse Kriegspiel entrypoint with public reserves, hidden drops, and exact reserve-identity capture announcements
  • DutchGame: Dutch / Can-I referee with one automatic public pawn notice, optional enquiries on later turns, and conditional “with Can-I” captures. The prompt excludes pawn captures before the notice and after a “No” for that turn.
  • EnglishGame: English convenience entrypoint with public illegal attempts and one-try ASK_ANY handling
  • RandGame: RAND convenience entrypoint with public rebuffs, pawn-try source-square announcements, typed captures, and promotion notices
  • Wild16Game: Wild 16 convenience entrypoint over the shared hidden-board engine
  • KriegspielMove: a player question, either a normal move or ASK_ANY
  • KriegspielAnswer: the referee response, including move outcome, captures, special announcements, and variant-specific public metadata

The repository's .python-version pins CPython 3.15.2 for development and production deployment. The published library supports all Python versions listed above; that repository pin does not restrict package installation.

Metadata

Release files for kriegspiel 1.8.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kriegspiel 1.8.5
File Size Uploaded Provenance Actions
kriegspiel-1.8.5.tar.gz 59.6 kB Without provenance Details for kriegspiel-1.8.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kriegspiel 1.8.5
File Interpreter ABI Platform Actions
kriegspiel-1.8.5-py3-none-any.whl Python 3 none any Details for kriegspiel-1.8.5-py3-none-any.whl

Total release size: 92.3 kB

Release files / kriegspiel-1.8.5.tar.gz

Download URL kriegspiel-1.8.5.tar.gz
Size 59.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1c1a6d1c096ad1b00dd6973b8fdc1a9c7001de626d7da35829d85084943c4400
BLAKE2b-256 checksum
How to use checksums
2b2bd28231a6fdc28c0fc7b6ead5377c151683421db3bda70d6316a5f7e13fc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / kriegspiel-1.8.5-py3-none-any.whl

Download URL kriegspiel-1.8.5-py3-none-any.whl
Size 32.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4225a85ee306a0e632f5da77de1cc11908fdb69d3f1e5bea1921dbf40e3b6c1
BLAKE2b-256 checksum
How to use checksums
3deb5c48d45cd290288c56ecf5af3e6f7ceaf260f317eaddb0cb04c10cf2f6d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for kriegspiel 1.8.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.8.5 This release

2 release files No provenance

0.9.0b5

0.9.0b4

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page