Skip to main content

Python hidden-information chess engine for Berkeley-family Kriegspiel variants

Project description

kriegspiel

PyPI version

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 engine
  • BerkeleyGame: backward-compatible Berkeley-named wrapper over KriegspielGame
  • CincinnatiGame: Cincinnati convenience entrypoint with public NONSENSE and binary pawn-capture announcements
  • 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kriegspiel-1.4.4.tar.gz (42.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kriegspiel-1.4.4-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file kriegspiel-1.4.4.tar.gz.

File metadata

  • Download URL: kriegspiel-1.4.4.tar.gz
  • Upload date:
  • Size: 42.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for kriegspiel-1.4.4.tar.gz
Algorithm Hash digest
SHA256 f59dcc0d1f0e462bb3de637ac96a60ece9e8de9053776d7098ce5d8add3e1fb9
MD5 eb5093fbdd27023e718a19014318c075
BLAKE2b-256 d5efbf94589a6484f2257b67a5b348ca10a9231809a2faacf3f68e65fea629ff

See more details on using hashes here.

File details

Details for the file kriegspiel-1.4.4-py3-none-any.whl.

File metadata

  • Download URL: kriegspiel-1.4.4-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for kriegspiel-1.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 24ab02fc07c1e4cb90fd506b664e483ddeb34b87a1f1d519cc04091f99f27ea2
MD5 0198461465c99fbe6771db0f6dc833e7
BLAKE2b-256 080907157e1481eaaa45d450a6535d0a71d49fdc8165d6c705aa952f43fe6fdf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page