Skip to main content

Algorithms for minesweeper.

Project description

ms_toollib

pypi MIT docs

A cross-platform minesweeper algorithm toolbox with a native Rust core.

Supports Python 3.7–3.13 on Windows, Linux, and macOS.


Installation

pip install ms_toollib

No additional dependencies required.


Features

Category Description
Mine Laying Random mine placement (first-click safe, Win7-style), no-guess mine generation (filter & adjustment methods)
Board Metrics 3BV, 3BV/s, openings (Op), islands (Isl), ZiNi (Greedy/Human/Random)
Probabilities Per-cell mine probability with block decomposition and enumeration
Deduction Solver 3-tier solver: direct subset, subtract-and-compare, full enumeration (≤55 cells)
Solvability Check Determine if a board is no-guess, find unsolvable structures
Game State Machine MinesweeperBoard / SafeMinesweeperBoard that accepts mouse clicks and tracks full game state
Replay Parsing Read AVF, EVF, MVF, RMV formats; save/write EVF (v0–v4) and EVFS containers
Optical Recognition Recognize board state from an RGBA image via ONNX neural network (Sobel, Hough, DP)

Quick Start

import ms_toollib as ms

# Generate a no-guess Beginner board
board = ms.laymine_solvable(9, 9, 10)
print(ms.cal_bbbv(board))          # 3BV
print(ms.cal_zini(board, 1))       # Greedy ZiNi

# Per-cell mine probability
prob = ms.cal_probability_onboard(board, 10)

# Parse a replay
video = ms.AvfVideo("replay.avf")
video.parse()
video.analyse()
print(video.bbbv)

See the full documentation for detailed API references.


Public API

Functions (30+): cal_all_solution, cal_bbbv, cal_board_numbers, cal_hzini, cal_op, cal_probability, cal_probability_onboard, cal_rzini, cal_zini, get_all_not_and_is_mine_on_board, is_able_to_solve, is_guess_while_needless, is_solvable, laymine, laymine_op, laymine_solvable, laymine_solvable_adjust, laymine_solvable_thread, mark_board, obr_board, refresh_board, refresh_matrix, refresh_matrixs, refresh_matrixses, sample_bbbvs_exp, solve_direct, solve_enumerate, solve_minus, unsolvable_structure, valid_time_period

Classes (15): AvfVideo, BaseVideo, Board, EvfVideo, Evfs, EvfsCell, GameBoard, KeyDynamicParams, MinesweeperBoard, MvfVideo, RmvVideo, SafeBoard, SafeBoardRow, SafeMinesweeperBoard, VideoActionStateRecorder


Supported Platforms

OS Architectures
Windows x86, x64
Linux x86, x86_64, aarch64, armv7, ppc64le, s390x
macOS x86_64, aarch64

Source & Issues

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

ms_toollib-1.5.15.tar.gz (312.1 kB view details)

Uploaded Source

Built Distributions

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

ms_toollib-1.5.15-cp38-abi3-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8+Windows x86-64

ms_toollib-1.5.15-cp38-abi3-win32.whl (2.3 MB view details)

Uploaded CPython 3.8+Windows x86

ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ x86-64

ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_i686.whl (2.9 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ i686

ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_aarch64.whl (3.3 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

ms_toollib-1.5.15-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

ms_toollib-1.5.15-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

ms_toollib-1.5.15-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl (2.8 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.12+ i686

ms_toollib-1.5.15-cp38-abi3-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

ms_toollib-1.5.15-cp38-abi3-macosx_10_12_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file ms_toollib-1.5.15.tar.gz.

File metadata

  • Download URL: ms_toollib-1.5.15.tar.gz
  • Upload date:
  • Size: 312.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ms_toollib-1.5.15.tar.gz
Algorithm Hash digest
SHA256 38a1ce402ab6dca9fc8dfc1db84eded66706925c9aa438e50be42945d71df442
MD5 6701305e428a45c7718845b94c1444cf
BLAKE2b-256 9c9e15c9b43823a3d5339611f9d40468d0d9fc5602de2e3b524a0d93e4bcb508

See more details on using hashes here.

File details

Details for the file ms_toollib-1.5.15-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: ms_toollib-1.5.15-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ms_toollib-1.5.15-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f4a350c8ee987690fa6bfaaababb4b2b3979c9c3d185d824b30930730a104403
MD5 0e852eaffbcedfd052be159f8f181120
BLAKE2b-256 4b63adf49ff990fbf0d24250920a7794a6c8cf9c5a782ec5e56618fc67c486af

See more details on using hashes here.

File details

Details for the file ms_toollib-1.5.15-cp38-abi3-win32.whl.

File metadata

  • Download URL: ms_toollib-1.5.15-cp38-abi3-win32.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ms_toollib-1.5.15-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 4f5b85c5de08f591c1268c71f987fc93be4a11ebc721d4a768a711bdef629edb
MD5 bc7bf7338b8d543fc4974185ebc2a693
BLAKE2b-256 8d6d16eb9dab4fd83d0b8af3378bc6ebec7f403c7f56250af5437c02583a29ef

See more details on using hashes here.

File details

Details for the file ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: CPython 3.8+, musllinux: musl 1.2+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7b4610b1dce95866381d29bb3f4f4ecb68dcfd4617f9d5a5b39c514cb83503f6
MD5 105a0bd0efab73dfa4f1e34f123795db
BLAKE2b-256 c3229deb9428032897252e0779f612319a331f79a9f28c8edcf1e249fae284e3

See more details on using hashes here.

File details

Details for the file ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_i686.whl.

File metadata

  • Download URL: ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_i686.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.8+, musllinux: musl 1.2+ i686
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 cec48b99a21cd2baa25bf7b07848a5bb7c6dac83be76248f7a2841f87a5510ac
MD5 988e840ea8e880158a11cc9223b1a195
BLAKE2b-256 d8654e9756e266c4ac1f489f58c77a6d98dc5c0700230d650e596a6e32ee976b

See more details on using hashes here.

File details

Details for the file ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

  • Download URL: ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_aarch64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.8+, musllinux: musl 1.2+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ms_toollib-1.5.15-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 9592c1e0606a1d7ebab1b84a08c0ba98af26327af9e7e6ae6c141728918953bf
MD5 5713c24c560bdcf2f91008c2891ebb98
BLAKE2b-256 93c4710de30c4dd45d6f2faf0ae1628abb44967ca55e9f614bf232ad2d3e606a

See more details on using hashes here.

File details

Details for the file ms_toollib-1.5.15-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: ms_toollib-1.5.15-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ms_toollib-1.5.15-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a6cde0dce781fde49f3f47b5ab6bde54c27874afb90f10a8ddf72acb65fcbbdc
MD5 2e7c654e43aa2daa711ec4a755c5230e
BLAKE2b-256 80358d9577e0a28372b6dae562dda1d1eca94a6f9be0b24ae0f932f8c96bd452

See more details on using hashes here.

File details

Details for the file ms_toollib-1.5.15-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: ms_toollib-1.5.15-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ms_toollib-1.5.15-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 edae4073593db4fcf99e518370b4346a7b37b52f2be45fd7d2d3a95dfcfe31e1
MD5 e8e01ac0cb0b69ea55e859bcf20f7cac
BLAKE2b-256 e9a1c7b76aad9921b6088f9bf9be7b51e01eede780124824dca5f7e7e69cfd08

See more details on using hashes here.

File details

Details for the file ms_toollib-1.5.15-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

  • Download URL: ms_toollib-1.5.15-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.8+, manylinux: glibc 2.12+ i686
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ms_toollib-1.5.15-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 7f6d33f33b88b4d0cb584e8972944882a42dc4602c956939b239797baf9002e0
MD5 f7a87ca2fb77ec10e0e6d44ecc12e496
BLAKE2b-256 39ace218f0212e799662e301d43a9492027c0dd1fa6af8d28ae83376ed115023

See more details on using hashes here.

File details

Details for the file ms_toollib-1.5.15-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: ms_toollib-1.5.15-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.8+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ms_toollib-1.5.15-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6a9976121b7c3a98275313f766f5cd12932997c3acbe0b116d71e978bbdc97e6
MD5 8d087ed6e128732ff12d75a51397b48b
BLAKE2b-256 eb158e5747d9e2dd6640ce7b6742d8daa53e47b750c9f3a110cf7f6d9310c755

See more details on using hashes here.

File details

Details for the file ms_toollib-1.5.15-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: ms_toollib-1.5.15-cp38-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.8+, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ms_toollib-1.5.15-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c45b8a8e6f15f0a2817cb5c2c871fafbb2a4681d630688a643f69f220fc3f001
MD5 da38a254fcc69c03438b45c54e226552
BLAKE2b-256 1beeb62e9f68c8b2ea48612e3970c9b8274b483602f044a55cb5f7ea8b0634b4

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