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

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

cincinnati = CincinnatiGame()
print(cincinnati.current_turn_has_pawn_capture)

crazykrieg = CrazyKriegGame()
print(crazykrieg.public_reserve_summary)

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
  • 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

Links

Metadata

Release files for kriegspiel 1.7.3

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.7.3
File Size Uploaded
kriegspiel-1.7.3.tar.gz 53.2 kB Details

Built distribution (wheel)

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

Total release size: 83.8 kB

Release files / kriegspiel-1.7.3.tar.gz

Download URL kriegspiel-1.7.3.tar.gz
Size 53.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f98e6a6ebadbd87c7b6576f1b9af940fdcdb942ac3e9f881a2de74935000159b
BLAKE2b-256 checksum
How to use checksums
38c3030fcbbdd920c92c5213bc741860f476f1418cc3fa28b562e02ee7904f99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

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

Download URL kriegspiel-1.7.3-py3-none-any.whl
Size 30.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4bd8078852524c527449f62396891e85a60d4d39533cf126da0fe54a7451636
BLAKE2b-256 checksum
How to use checksums
8553b211a672588224d74d329db1c2a5d4947261dd018964be92ca797ae3cdf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3
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