RS10 board game environment (Gymnasium + PyTorch) and heuristic strategies
Project description
RS10Env
Gymnasium-compatible RS10 board game environment and heuristic strategies (PyTorch).
Install
By default the project uses CPU-only PyTorch (smaller install; no GPU/CUDA needed if you are not training):
# With uv (recommended; installs torch from PyTorch CPU index)
uv add rs10env
# Or from source: clone repo, then sync in project root
git clone https://github.com/xx025/rs10env.git
cd rs10env
uv sync
For GPU/CUDA, install the matching torch first, then rs10env, e.g.
uv pip install torch --index-url https://download.pytorch.org/whl/cu124, then uv sync.
Environment
RS10Env is a turn-based env: each step selects a rectangle whose cells sum to a target (default 10) and clears it. Board: H×W (default 16×10), cells 0–9. Full spec (observation/action space, mask, reward): API reference.
API usage
See docs/API.md for environment API and code examples (single board, multi-game comparison, low-level env + strategy).
Streamlit app
Two modes: single board (multiple strategies) and multi-game comparison (with progress). Best strategy is highlighted.
uv add rs10env[app]
rs10env-app
# or from repo root
uv run streamlit run app.py
Strategies
random— uniform over valid actionsgreedy— clear as many cells as possiblecenter_bias— prefer rectangles closer to board centerlarge_rect/small_rect— prefer larger / smaller areacenter_small_rect— center + small areaepsilon_greedy— ε-greedymax_future_moves— choose action that maximizes valid moves on the next state
Benchmark (strategy comparison)
Batch runs on a fixed set of boards (16×10, target_sum=10). Below: 100k games per strategy. “Best count” / “Share” = times that strategy cleared the most cells in a game.
| Strategy | Tests | Avg steps | Avg removed | Time/game (s) | Best count | Share (%) |
|---|---|---|---|---|---|---|
| random | 100,000 | 40.72 | 96.82 | 0.32 | 1,109 | 1.11 |
| greedy | 100,000 | 36.38 | 92.11 | 0.31 | 244 | 0.24 |
| center_bias | 100,000 | 43.15 | 101.15 | 0.31 | 5,185 | 5.19 |
| large_rect | 100,000 | 36.33 | 91.57 | 0.31 | 212 | 0.21 |
| small_rect | 100,000 | 45.77 | 103.44 | 0.39 | 7,316 | 7.32 |
| center_small_rect | 100,000 | 46.31 | 104.65 | 0.52 | 10,643 | 10.64 |
| max_future_moves | 100,000 | 50.07 | 113.54 | 8.12 | 80,793 | 80.79 |
max_future_moves clears the most on average and wins most often, at higher per-game cost; center_small_rect and small_rect offer a good trade-off.
Cells removed by strategy (boxplot):
Best-strategy share (who clears the most in each game):
Cumulative average cells removed over games:
Dependencies
- Python >= 3.10
- PyTorch >= 2.0
- Gymnasium >= 1.0
- NumPy >= 1.24
Related projects
This repo focuses on simulation environment and strategies (Gymnasium + heuristics). Other open-source projects that implement automation or assist tools for similar number-sum-elimination mechanics (various platforms):
| Project | Platform | Description |
|---|---|---|
| nusery (longlifedahan) | Web | HTML/JS frontend, playable demo |
| Opening_Nursery_For_Mac | macOS | Python, pyautogui + OpenCV + Tesseract |
| nursery-bot | Windows | Python bot, Tesseract OCR |
| KaiJuTuoErSuo | Android | Java + ADB, OpenCV, OCR, DFS for elimination path |
| tuoersuo | — | Automation script (Gitee) |
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 rs10env-0.1.0.tar.gz.
File metadata
- Download URL: rs10env-0.1.0.tar.gz
- Upload date:
- Size: 4.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebba62f847ebe2fdeb189facdca63f294bb16cba1c9ff098fe2466f3db5f783f
|
|
| MD5 |
70f8818ed3a8e6b28c1b72c168d1bb5b
|
|
| BLAKE2b-256 |
233727754bbfbd523e7b1910c87be958d2fad78afdb19202d1ab566853c18a4e
|
Provenance
The following attestation bundles were made for rs10env-0.1.0.tar.gz:
Publisher:
publish.yml on xx025/rs10env
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rs10env-0.1.0.tar.gz -
Subject digest:
ebba62f847ebe2fdeb189facdca63f294bb16cba1c9ff098fe2466f3db5f783f - Sigstore transparency entry: 926728160
- Sigstore integration time:
-
Permalink:
xx025/rs10env@abe75b1f11c0a7816977665623d8996724343776 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/xx025
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@abe75b1f11c0a7816977665623d8996724343776 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file rs10env-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rs10env-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
104d3726b665c34fd22abe9e5ee8be799c24c135dea6b87699572d2ba55b6b68
|
|
| MD5 |
40178bdd638975d9bc120ec24465b2d0
|
|
| BLAKE2b-256 |
55b6c64e57467e88ddc2820d0dcf159c2d504df9dbd926ebc96f01cea6c0dd27
|
Provenance
The following attestation bundles were made for rs10env-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on xx025/rs10env
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rs10env-0.1.0-py3-none-any.whl -
Subject digest:
104d3726b665c34fd22abe9e5ee8be799c24c135dea6b87699572d2ba55b6b68 - Sigstore transparency entry: 926728188
- Sigstore integration time:
-
Permalink:
xx025/rs10env@abe75b1f11c0a7816977665623d8996724343776 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/xx025
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@abe75b1f11c0a7816977665623d8996724343776 -
Trigger Event:
workflow_dispatch
-
Statement type: