Skip to main content

Python port of okey-solver-ts and okey-vision-ts

Project description

Okey Solver Py Logo

okey-solver-py

Python library for solving Okey & Rummikub tile arrangements and processing board layouts.

PyPI version tests Python support License


Features

  • Backtracking Solver: Optimal arrangement solver for Okey / Rummikub games.
  • Pairs/Double Play: Find identical pairs.
  • Extensible Vision Engine: Process frames natively with numpy arrays (OpenCV), PIL, base64 strings, bytes, and paths.
  • Provider Support: Native local YOLO (ultralytics) and cloud Roboflow API implementations.

Installation

pip install okey-solver-py

Quick Start

Basic Solver Arrangement

from okey_solver import SolverEngine, Tile, TileColor

tiles = [
    Tile(id="r5", color=TileColor.RED, value=5),
    Tile(id="r6", color=TileColor.RED, value=6),
    Tile(id="r7", color=TileColor.RED, value=7),
]
result = SolverEngine.findBestArrangement(tiles)
print(result.totalScore)

With Roboflow Provider

from okey_vision import RoboflowProvider, VisionSolverEngine

provider = RoboflowProvider(
    api_key="your_api_key",
    model_id="rummikub-5bldr",
    model_version=1
)

engine = VisionSolverEngine(provider)
result = engine.analyze_frame("image_path.jpg")
print(result["tiles"])
print(result["arrangement"])

With Local YOLO Model

from okey_vision import LocalYoloProvider, VisionSolverEngine

provider = LocalYoloProvider(
    model_path="./models/yolov8_best.pt"
)

engine = VisionSolverEngine(provider)
result = engine.analyze_frame("board_layout.jpg")
print(result["arrangement"])

Extended Documentation

For details on architecture, rules, and APIs:

  • 🏗 Architecture & Flow - Details on pipeline stages, frame adapters, and observers.
  • 📜 Game Rules Reference - Okey rules, 12-13-1 circular runs, joker and false okey logic.
  • 💻 CLI Usage Guide - Guide to running okey-solve and okey-vision terminal applications.
  • 🤖 Telegram Bot Demo - Telegram Bot server example integrating image detection and layout solving.

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

okey_solver_py-0.3.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

okey_solver_py-0.3.0-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: okey_solver_py-0.3.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for okey_solver_py-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b30bcb5d9c013b26885955308da739d48c4e24104cd4824d49b99862df39aa6c
MD5 ba079f0e688943598dfeff82fd1b64e6
BLAKE2b-256 6d56b17c511a41656660dc215af25b92298dfd5b117bb91d0ea2c998504a04fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for okey_solver_py-0.3.0.tar.gz:

Publisher: release.yml on AtaCanYmc/okey-solver-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: okey_solver_py-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for okey_solver_py-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62d8f4717d3c3218091e6b01baba3e9c260408ce9157ded6e5a2bca13536ca2c
MD5 4fd2ba3a6f98211020e133580944cdcd
BLAKE2b-256 c69f6f02dd06f68c67c3a0a986cc9a5ea8310719122686c97f15a2168b4cd907

See more details on using hashes here.

Provenance

The following attestation bundles were made for okey_solver_py-0.3.0-py3-none-any.whl:

Publisher: release.yml on AtaCanYmc/okey-solver-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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