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/
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.
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
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
pip install kaboom-engineLocal editable install:
git clone https://github.com/Arnav-Ajay/kaboom-core.git
cd kaboom-core
pip install -e .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
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
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/
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
Core modules:
Main entrypoints:
GameEngineGameStateapply_action(state, action)get_valid_actions(state)
Run the test suite with:
pytestImportant test coverage areas:
- setup and dealing
- powers
- reactions
- turn flow
- Kaboom endgame
- memory updates after card movement
MIT