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
  • 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, or pick a ruleset with ruleset=....

Wild 16 also has its own convenience entrypoint:

from kriegspiel import Wild16Game

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 entrypoint for the same engine
  • 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.3.2.tar.gz (37.9 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.3.2-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for kriegspiel-1.3.2.tar.gz
Algorithm Hash digest
SHA256 e0c98b9927bf579e27b938c1cce1f690c7f46b13b8f7dfcbf91525667efbb710
MD5 fd62b7cb1d8629369d63c341918dbe6d
BLAKE2b-256 767a48c0e38379b9ad5ddf9ae8176e39391b84abe3c2571dcf0439ac4bed6203

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kriegspiel-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 23.4 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.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ec44439ece7363ddf6ac6fbb081481ac76b7613fd7d611e0b4324ed5e52d7c30
MD5 436f71baa9f06f47be75d2f8fe4311ec
BLAKE2b-256 16a1321c5f1118284017a67dc3b16b4c7419a896dfc6b1bd9599fc7bb3d581b4

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