Core game engine for the Kaboom card game.
Project description
Kaboom Engine
kaboom-engine is the deterministic rules engine for the Kaboom card game.
Current release line: 0.3.x
It is intended to be reused by:
- CLIs
- simulations and AI agents
- multiplayer servers
- future graphical clients
- development inspection tools
Live prototype client:
- Streamlit prototype: https://kaboom.streamlit.app/
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
0.3.1 Patch Notes
Patch updates made after the 0.3.0 line:
- memory updates were tightened for replace, swap, and removal flows
- pending-power target cards are locked while the power is still in motion
- discard-window behavior was tightened around Kaboom final-round resolution
- wrong-reaction penalty defaults were simplified back to one failed attempt per player per discard event
- deck draws now consistently reshuffle from discard through shared draw helpers when needed
- docs and regression coverage were expanded around reaction, power, and memory edge cases
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 requiredOpeningPeekactions before round 1 begins
Docs
Reference docs live in docs/:
These documents describe:
- state and phase flow
- action dispatch
- memory invariants
GameEnginemethods- parameters and return types
- ownership boundaries between engine and UI
Related Projects
kaboom-clifor terminal-based engine debuggingkaboom-streamlit-prototypefor a browser-based development inspector and human-vs-agent prototype- Live Streamlit deployment: https://kaboom.streamlit.app/
Examples
Two maintained examples live in examples/:
game_info_demo.pyfor inspecting setup, memory, and legal actionsrandom_policy_simulation.pyfor a simple simulation / AI / RL-style rollout loop
Architecture
Core modules:
Main entrypoints:
GameEngineGameStateapply_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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kaboom_engine-0.3.1.tar.gz.
File metadata
- Download URL: kaboom_engine-0.3.1.tar.gz
- Upload date:
- Size: 30.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3b0ca169cd1d0a10977364abe4a74a6ad0c8746ec782516c3224580caca73c6
|
|
| MD5 |
ac6a512a70849056e89382f3bdf72614
|
|
| BLAKE2b-256 |
0a628498cb7e63ea31eedd7de62b321f85680e10824e78bff6c17c73108344ee
|
File details
Details for the file kaboom_engine-0.3.1-py3-none-any.whl.
File metadata
- Download URL: kaboom_engine-0.3.1-py3-none-any.whl
- Upload date:
- Size: 26.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
273f06fb2ac52df8899fd2a966e813f83d7324d934021e747350b8c435b0704c
|
|
| MD5 |
8a95180764e7b10be24d825bf65278fa
|
|
| BLAKE2b-256 |
ea33273ae5cfb7a03ab4bf95a33c84efbddfcde77c4b9a2ea808df251d664eaa
|