Skip to main content

Core game engine for the Kaboom card game.

Project description

Kaboom Engine

A deterministic Python engine for the Kaboom card game.

The project implements the full game logic including turns, reactions, powers, and endgame rules, designed to be used as a reusable simulation engine, AI environment, or UI backend.


Features

  • Complete Kaboom game rules
  • Deterministic turn engine
  • Reaction resolution system
  • Card power mechanics
  • Kaboom endgame logic
  • Deck reshuffle handling
  • Action-based engine architecture
  • Event-based results
  • Fully tested core logic

The engine is designed so it can be used for:

  • CLI or graphical game clients
  • AI agents
  • game simulations
  • multiplayer servers
  • reinforcement learning environments

Installation

Clone the repository:

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

Install locally:

pip install -e .

Basic Usage

from kaboom import GameState, apply_action
from kaboom.game.actions import Draw, Discard

state = GameState.new_game()

apply_action(state, Draw(actor_id=0))
apply_action(state, Discard(actor_id=0))

Running Simulations

The engine supports automated play.

import random
from kaboom import GameState, apply_action
from kaboom.game.turn import get_valid_actions

state = GameState.new_game()

while True:
    actions = get_valid_actions(state)

    if not actions:
        break

    action = random.choice(actions)
    apply_action(state, action)

This allows thousands of games to be simulated for testing or AI training.


Architecture

The engine follows a modular architecture:

GameState
    |
Action (Draw / Discard / Replace / UsePower / CallKaboom)
    |
apply_action()
    |
ActionResult

Key components:

kaboom/cards      → card definitions
kaboom/players    → player state
kaboom/powers     → power system
kaboom/game       → turn engine, reactions, validators

This separation keeps game logic independent from any UI layer.


Project Structure

kaboom/
    cards/
    players/
    powers/
    game/
        actions.py
        game_state.py
        phases.py
        reaction.py
        results.py
        turn.py
        validators.py

tests/

Testing

The engine includes a full pytest test suite.

Run tests:

pytest

Current coverage includes:

  • card scoring
  • deck creation
  • player management
  • power mechanics
  • turn actions
  • reaction logic
  • Kaboom endgame rules
  • full game initialization

Future Improvements

Planned enhancements:

  • CLI interface
  • graphical UI
  • AI player agents
  • multiplayer networking
  • replay and event logging
  • Gym-compatible environment for reinforcement learning

License

This project is licensed under the MIT License.


Author

Arnav Ajay


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.1.0.tar.gz (14.3 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.1.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kaboom_engine-0.1.0.tar.gz
  • Upload date:
  • Size: 14.3 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.1.0.tar.gz
Algorithm Hash digest
SHA256 e6a2750149418d680324ee7c62263b40108013a7db21bb42ea3e2b2501486cd1
MD5 f3f4a7eefde82273a872a53a6894fadc
BLAKE2b-256 6effed4f9493864ff9d9e4c9a4f4479afa961093dc24c114001df9726da7be19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kaboom_engine-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce3bdd97310f1222741d99ac0b052956455dd9f395b36d88423355dd73bc10ea
MD5 6ea7eca9d39fa11dc17f6341081de2ca
BLAKE2b-256 29355cc2a99924050060d6064f58309fa0bfebc3dd5b74588534b0a576eaf4d6

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