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.12.tar.gz (284.5 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.12-cp38-abi3-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8+Windows x86-64

ms_toollib-1.5.12-cp38-abi3-win32.whl (2.2 MB view details)

Uploaded CPython 3.8+Windows x86

ms_toollib-1.5.12-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.12-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.12-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.12-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view details)

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

ms_toollib-1.5.12-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.1 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

ms_toollib-1.5.12-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.12-cp38-abi3-macosx_11_0_arm64.whl (2.5 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

ms_toollib-1.5.12-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.12.tar.gz.

File metadata

  • Download URL: ms_toollib-1.5.12.tar.gz
  • Upload date:
  • Size: 284.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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.12.tar.gz
Algorithm Hash digest
SHA256 566545d29e6be0a9bf0d97a15a000cd0943fbbe30f4635555cc136e7c5e94d94
MD5 1e24694dea87ddd7eb4add292107ba6a
BLAKE2b-256 ace2409b258627da10f3546d573978e46d825545b4569ccff87be27d3308fca3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ms_toollib-1.5.12-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.24 {"installer":{"name":"uv","version":"0.11.24","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.12-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0d33306224b581ee124086dcf5fd7f27ee837f9507fff0c46b91084f3799afc1
MD5 a8a5829a925855166b89f4d567efe403
BLAKE2b-256 9f0d4b23abb34c8a473f8289d9fbc496950269d64cf733d249ef9c601903a383

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ms_toollib-1.5.12-cp38-abi3-win32.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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.12-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 febe97d0afec522d9024b511a9a2454060f00aed4ef21eec75d9809f0ed92cde
MD5 a99500a73e3f4cc43b9b3b9ed6559079
BLAKE2b-256 cfddec37e534401ecaf29186a6ce73454f0c113f28297e1903c2d8399fc52407

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ms_toollib-1.5.12-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.24 {"installer":{"name":"uv","version":"0.11.24","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.12-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d16ab385ef329e00d3b83eca203ca7b5382509f37675e1682dcda3f5d9c1d700
MD5 fcc1c5b10d8a8f58b5210ee91d0868a5
BLAKE2b-256 9ae41471af47dc0f4a19c1473198acdc96421c6d932e49130271d24da69fc0c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ms_toollib-1.5.12-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.24 {"installer":{"name":"uv","version":"0.11.24","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.12-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 0bdc1af301caba1e9c0910282eefe4c6c05e0f902ee2107c1f54c0a933fd74f7
MD5 24664871c3e550a62d6403ba3a4b59e3
BLAKE2b-256 b4d3e9a86b678660cb6463c588046abf6c1211eff00a06de49e3baab49123cfd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ms_toollib-1.5.12-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.24 {"installer":{"name":"uv","version":"0.11.24","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.12-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 e4cbc9f551afe1db9e1090bbfe882246e822736f54b4b1aa77a2e402f39f74ea
MD5 9169e3d335d3d34571d86a4534a08152
BLAKE2b-256 7b6af365835ed86782a8b42c97e69e388bc8c9cb7035d4e7a09242779961d061

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ms_toollib-1.5.12-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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.12-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c015f7b90bf5d35c32922e1e927e425d16c7935e1902a11f35790df6c29a7355
MD5 d8b93a9c7094e06d728686bd53d1afb4
BLAKE2b-256 5000dc0e5e5d3c181fe9735abae3ea71f9d861dc8712ddf21a2f4d0d05013582

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ms_toollib-1.5.12-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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.12-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4cc4163e2f79b35226d072f54f373ef547891988dfed0f91207eb7e84d736743
MD5 0f8c72506b38cce514bdbc8095877e7c
BLAKE2b-256 003294f7b003d1df27f8f69d349924d181f26f5e599920742c87be60f0921892

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ms_toollib-1.5.12-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.24 {"installer":{"name":"uv","version":"0.11.24","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.12-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 ebd4c1622a89f8afca6097069c4783265726b73e3ec6a3b9ac674436db38b8d3
MD5 2caedf4dc09d19b7bc25ae2ed0c3cc80
BLAKE2b-256 d3f620aedd46bd55a614481440fd7ef4e594236aec0fcf13757adfa1c634070b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ms_toollib-1.5.12-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.8+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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.12-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 62f2dff0cc3e147f436cde50065940bbd4a9afe4771f5391eb206fce0de6662b
MD5 3ba1019dbfab16552afd9fa37890f8f8
BLAKE2b-256 26f4f5bc8db99adb4a55ef2150462b2b561e8cdc4570c864cb86d29d1903c576

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ms_toollib-1.5.12-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.24 {"installer":{"name":"uv","version":"0.11.24","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.12-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b3b3235117cb612c2fd54fd4be3bd69d83d5c5ce7cf5b6868b9be211d60fb9a9
MD5 7135bf2e9125ae3c9b3fcf7281381413
BLAKE2b-256 e88bd50676cb3f40adf9cb70059838f662b0f5bac75a9b5b02c4b78b6a34a07f

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