Skip to main content

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

Project description

kriegspiel

PyPI version

Python game engine for the Berkeley Kriegspiel referee rules.

Current scope:

  • Berkeley Kriegspiel
  • Berkeley + Any

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")

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, and special announcements

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.2.6.tar.gz (32.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.2.6-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kriegspiel-1.2.6.tar.gz
  • Upload date:
  • Size: 32.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.2.6.tar.gz
Algorithm Hash digest
SHA256 a65b7552009cd0670e7b87d3b6288f16778d2c4cd357eb40f215bb4fa64e9dca
MD5 716e75fae558114932c85b3904302032
BLAKE2b-256 ade6c60a45510673b1ecd058422bc376741a4621bea7a82ddfa64a4eab2f4be5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kriegspiel-1.2.6-py3-none-any.whl
  • Upload date:
  • Size: 20.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.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fb1b2949121023bd60e2304cd75c681a3c95fb7f3007952e76fec0da472c2392
MD5 eb5e8ee481e15dd6d1d2284a8cad4cf0
BLAKE2b-256 228fd6847ce4908f2b879eb70de6d7592c038d667775fc66d6ce714e31bdb197

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