Rummikub solver console with multi-game support and persistence.
Project description
Rummikub Console
A Rummikub solver console supporting multiple games and persistence, written in Python.
The algorithm used builds on the approach described by D. Den Hertog, P. B. Hulshof (2006), "Solving Rummikub Problems by Integer Linear Programming", The Computer Journal, 49(6), 665-669 (DOI 10.1093/comjnl/bxl033).
Features
- Can track multiple games, letting you switch between named games
- Saves tracked games automatically
- Can work with different Rummikub rules, letting you adjust the number of colours, tiles, and other aspects
- You can freely adjust what tiles are on the rack or on the table, within the limits of what tiles are available according to the current rules
- Can be used with any of the Mixed-Integer Linear Programming (MILP) solvers supported by cvxpy.
Solver improvements
The original models described by Den Hertog and Hulshof assume that all possible sets that meet the minimum length requirements and can't be split up are desirable outcomes.
However, any group set (tiles with the same number but with different colours) containing at least one joker, but which is longer than the minimal run, in effect contains a redundant joker, something you wouldn't want to leave on the table for the next player to use. The same applies to run sets (tiles of the same colour but with consecutive numbers), that are longer than the minimal set length but start or end with a joker. In this implementation, such sets are omitted from the possible options.
The implementation also includes a solver for the initial move, where you can only use tiles from your own rack and must place a minimum amount of points before you can use tiles already on the table. This solver is a variant of the original solver that maximizes tiles placed, but is constrained by the minimal point amount and disregards jokers (which means jokers are only used for the opening meld if that is the only option available).
Install
You can install this project the usual way:
$ pip install RummikubConsole
or use a tool like pipx or uv to help you manage command-line tool installations like these:
Using pipx:
$ pipx install RummikubConsole
Using uv:
uv tool install RummikubConsole
or, running the console directly:
uvx --from RummikubConsole rsconsole
Picking an alternative solver backend
This program uses the rummikub-solver library to model the Rummikub game, and this library can work with different backends. See the library documentation on what backends can be installed.
You can install additional backends with uv by adding --with rummikub-solver[EXTRA_NAME] to the uv tool command-line.
You can then use the --solver-backend switch to pick an alternative backend; when you run rsconsole --help, provided there are extra backends available, those that are installed will be listed:
$ rsconsole --help
...
--solver-backend [glpk_mi|highs|scip|scipy]
Mixed-Integer solver to use.
When HiGHS is installed, it is automatically used as the default solver.
Usage
Run the rsconsole command-line tool to open the console, or run rsconsole --help to see how you can adjust the Rummikub rules (you can adjust tile count, colours, joker count, the minimum number of tiles to make a set and the minimum score for the initial placement).
You then enter the console command loop. Enter ? or h or help to list the available commands, and help <command> to get help on what each command does.
Development
The source code for this project can be found on GitHub.
When running locally, install uv, then run:
uv run rsconsole
to run the console solver.
Credits
The initial version of the solver and console were written by Ollie Hooper.
This version is a complete rewrite by Martijn Pieters, with new console implementation, expansion of the solver to improve performance and address shortcomings in the original paper, as well as multi-game, game state tracking and persistence support. The solver part has since been spun off into a standalone library.
Project details
Release history Release notifications | RSS feed
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 rummikubconsole-2.0.0.tar.gz.
File metadata
- Download URL: rummikubconsole-2.0.0.tar.gz
- Upload date:
- Size: 260.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29409490ac33825a0c8c40e002142716c0e41ca66170548477cdad1f4aa65803
|
|
| MD5 |
3b9e5b11fd4eb04a9d2f39c06588a4d3
|
|
| BLAKE2b-256 |
14219cec52e3dfc464fc6f2fb19b92fc700cdc18b6c80242a2a7f23b5918ee85
|
Provenance
The following attestation bundles were made for rummikubconsole-2.0.0.tar.gz:
Publisher:
ci-cd.yml on mjpieters/RummikubConsole
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rummikubconsole-2.0.0.tar.gz -
Subject digest:
29409490ac33825a0c8c40e002142716c0e41ca66170548477cdad1f4aa65803 - Sigstore transparency entry: 254736560
- Sigstore integration time:
-
Permalink:
mjpieters/RummikubConsole@9414800960b52566396076f50574b3e1db402dd1 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/mjpieters
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@9414800960b52566396076f50574b3e1db402dd1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rummikubconsole-2.0.0-py3-none-any.whl.
File metadata
- Download URL: rummikubconsole-2.0.0-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7119d5a1144555488710a0372ae8e7db5dafa5910f56b9d286f6b6f91ac22a9f
|
|
| MD5 |
f662e4d967790a174bd7860df56afbaf
|
|
| BLAKE2b-256 |
60f727e0f05e917332741b8849b89a097df399bf8942e15a8f0deb220435aec8
|
Provenance
The following attestation bundles were made for rummikubconsole-2.0.0-py3-none-any.whl:
Publisher:
ci-cd.yml on mjpieters/RummikubConsole
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rummikubconsole-2.0.0-py3-none-any.whl -
Subject digest:
7119d5a1144555488710a0372ae8e7db5dafa5910f56b9d286f6b6f91ac22a9f - Sigstore transparency entry: 254736571
- Sigstore integration time:
-
Permalink:
mjpieters/RummikubConsole@9414800960b52566396076f50574b3e1db402dd1 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/mjpieters
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@9414800960b52566396076f50574b3e1db402dd1 -
Trigger Event:
push
-
Statement type: