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.
pip install kriegspielimport 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)KriegspielGame: the neutral public entrypoint for the shared hidden-board engineBerkeleyGame: backward-compatible Berkeley-named wrapper overKriegspielGameCincinnatiGame: Cincinnati convenience entrypoint with publicNONSENSEand binary pawn-capture announcementsCrazyKriegGame: Crazyhouse Kriegspiel entrypoint with public reserves, hidden drops, and exact reserve-identity capture announcementsEnglishGame: English convenience entrypoint with public illegal attempts and one-tryASK_ANYhandlingRandGame: RAND convenience entrypoint with public rebuffs, pawn-try source-square announcements, typed captures, and promotion noticesWild16Game: Wild 16 convenience entrypoint over the shared hidden-board engineKriegspielMove: a player question, either a normal move orASK_ANYKriegspielAnswer: the referee response, including move outcome, captures, special announcements, and variant-specific public metadata
- PyPI: kriegspiel
- Live site: kriegspiel.org
- Issues: github.com/Kriegspiel/ks-game/issues