Skip to main content

Core game engine for the Kaboom card game.

Project description

Kaboom Engine

PyPI Python License

kaboom-engine is the deterministic rules engine for the Kaboom card game.

Current release line: 0.3.0

It is intended to be reused by:

  • CLIs
  • simulations and AI agents
  • multiplayer servers
  • future graphical clients

What The Engine Owns

The engine is the source of truth for:

  • game setup and dealing
  • mandatory opening peek setup
  • legal action generation
  • turn and reaction phase transitions
  • card powers
  • Kaboom endgame flow
  • player memory mutation when cards move

Interfaces should choose and render actions, not reimplement rules.

What's New In 0.3.0

0.3.0 is the first fully rule-shaped engine release.

Highlights:

  • opening peek is now an explicit setup phase instead of an implicit side effect
  • power use is discard-first and shares the same contested discard window as reactions
  • pending power resolution is explicit through ResolvePendingPower
  • reactions are single-card claims, and the initiator may compete for the same discard event
  • wrong reaction guesses now reveal information, apply penalty, and keep the window open
  • Kaboom final-round discard windows fully resolve before the game ends
  • result metadata is richer for CLI, simulation, and future multiplayer/server layers

Install

pip install kaboom-engine

Local editable install:

git clone https://github.com/Arnav-Ajay/kaboom-core.git
cd kaboom-core
pip install -e .

Minimal Usage

from kaboom import GameEngine, get_valid_actions, apply_action

engine = GameEngine(game_id=0, num_players=2, hand_size=4)
state = engine.state

while not engine.is_game_over():
    actions = get_valid_actions(state)
    action = actions[0]
    apply_action(state, action)

Note:

  • a fresh game starts in the opening peek setup phase
  • get_valid_actions(state) already exposes the required OpeningPeek actions before round 1 begins

Docs

Reference docs live in docs/:

These documents describe:

  • state and phase flow
  • action dispatch
  • memory invariants
  • GameEngine methods
  • parameters and return types
  • ownership boundaries between engine and UI

Examples

Two maintained examples live in examples/:

Architecture

Core modules:

Main entrypoints:

  • GameEngine
  • GameState
  • apply_action(state, action)
  • get_valid_actions(state)

Testing

Run the test suite with:

pytest

Important test coverage areas:

  • setup and dealing
  • powers
  • reactions
  • turn flow
  • Kaboom endgame
  • memory updates after card movement

License

MIT

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

kaboom_engine-0.3.0.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

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

kaboom_engine-0.3.0-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file kaboom_engine-0.3.0.tar.gz.

File metadata

  • Download URL: kaboom_engine-0.3.0.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for kaboom_engine-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b0e7362ff7cfe56de7e210a0a57d6d251bb1cd32a6d13519fd490aaa02f553a8
MD5 625be855eb876131ce48acf24f16f2a4
BLAKE2b-256 b40f258f7f995edda4f42067018b8387492f64c7af6f4737e182322c9add6905

See more details on using hashes here.

File details

Details for the file kaboom_engine-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: kaboom_engine-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 25.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for kaboom_engine-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4e13977223fda546891bdede7e9ba40939d18419943afb85203202961052d98
MD5 b6d6fc6e324d643306e9daf3b6f491fe
BLAKE2b-256 f215312b5f8349bb71d5dbd001420d220761d850c5b910c9566ab6fbe46fad6f

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