Skip to main content

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

Project description

kriegspiel

PyPI version

Python game engine for Berkeley-family 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.berkeley import BerkeleyGame
from kriegspiel.move import KriegspielMove, QuestionAnnouncement

game = BerkeleyGame(any_rule=True)

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 = BerkeleyGame.load_game("game.json")

Wild 16 uses the same engine with an explicit ruleset:

wild16 = BerkeleyGame(ruleset="wild16")
print(wild16.current_turn_pawn_tries)

Main Concepts

  • BerkeleyGame: the referee and full hidden board state
  • 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.0.tar.gz (34.8 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.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kriegspiel-1.3.0.tar.gz
  • Upload date:
  • Size: 34.8 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.0.tar.gz
Algorithm Hash digest
SHA256 e390bdb3f819e01f49493746aa344ca89bc831172d84e5d80fb8b9070fbbaaec
MD5 bb78224a05bde1cf682b4a0480039e20
BLAKE2b-256 575bd67fc1685b42ba0378fc04beec79f1425827f73750a736b3840cf899024b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kriegspiel-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b24482702c2ef1a3b5f37278df4e8655f35385f058fbe23637028d8efe28b52
MD5 797393e9c864070bb6f4b5accf3b215c
BLAKE2b-256 58c7f341ad4b8d7afc684c643b454e684f8232326dbf2db980766926f3f737aa

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