Skip to main content

Minesweeper solver in Zig

Project description

Minesweeper solver

A minesweeper solver written in Zig.

The following cell representations are used for input boards:

  • # for an unclicked cell
  • <N> where N=0,1,2,... is a number shown in a cell
  • . as an alternative to 0 (since the number 0 is not normally shown)
  • * to represent a single mine (may be a revealed mine or a flag)
  • *<N> where N=1,2,... is the number of mines

Example usage:

$zig-main -f example2.txt 8 2>/dev/null

Board:
# 2 # # #
# # # # #
# 3 # # #
# 2 # 4 #
# # # # #

Matrix:
1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | 2
0 0 0 0 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 | 3
0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 1 1 1 0 0 | 2
0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 0 0 1 1 1 | 4
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 8

RREF matrix:
 1  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  1  1  0  0 |  1
 0  0  1  1  0  0  0  1  1  0  0  1  1  0  0  1  0  0  0  1  1 |  4
 0  0  0  0  1  1  1  0  0  0  0  0  0  0  0  0 -1 -1 -1  0  0 |  1
 0  0  0  0  0  0  0  0  0  1  0 -1 -1  1  0 -1  1  1  0 -1 -1 | -2
 0  0  0  0  0  0  0  0  0  0  1  1  1  0  1  1  0  0  1  1  1 |  4

Solver matrix:
 1  0  0  0  0  0  1  1 |  1
 0  1  0  0  0  1  0  0 |  4
 0  0  1  0  0  0 -1 -1 |  1
 0  0  0  1  0 -1  1  0 | -2
 0  0  0  0  1  1  0  1 |  4

Solver groups:
0: { 0, 1 }
1: { 2, 3, 7, 8 }
2: { 4, 5, 6 }
3: { 9, 13 }
4: { 10, 14 }
5: { 11, 12, 15, 19, 20 }
6: { 16, 17 }
7: { 18 }

Mine configurations:
0: { 1, 2, 1, 0, 2, 2, 0, 0 }
1: { 1, 1, 1, 1, 1, 3, 0, 0 }
2: { 1, 0, 1, 2, 0, 4, 0, 0 }
3: { 0, 1, 2, 0, 1, 3, 1, 0 }
4: { 0, 0, 2, 1, 0, 4, 1, 0 }
5: { 0, 2, 2, 0, 1, 2, 0, 1 }
6: { 0, 1, 2, 1, 0, 3, 0, 1 }

Probabilities:
0.2711 0.0000 0.2711 0.3133 0.3133
0.4859 0.4859 0.4859 0.3133 0.3133
0.2651 0.0000 0.5060 0.5494 0.5494
0.2651 0.0000 0.5060 0.0000 0.5494
0.1084 0.1084 0.2410 0.5494 0.5494

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

zig_minesolver-0.1.0-py3-none-win_amd64.whl (138.9 kB view details)

Uploaded Python 3 Windows x86-64

zig_minesolver-0.1.0-py3-none-win32.whl (152.9 kB view details)

Uploaded Python 3 Windows x86

File details

Details for the file zig_minesolver-0.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: zig_minesolver-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 138.9 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.5

File hashes

Hashes for zig_minesolver-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b1c0ebaae76802dd996526f077d10a5f26d1b1343cb3214bb3d6ff491993829a
MD5 99ff85a743cdab8722f76e55253ba00d
BLAKE2b-256 6b8f2efc08fd8302903d86f8f9ab93153e65afb7dcb9cd45679fb8123b4c49d3

See more details on using hashes here.

File details

Details for the file zig_minesolver-0.1.0-py3-none-win32.whl.

File metadata

  • Download URL: zig_minesolver-0.1.0-py3-none-win32.whl
  • Upload date:
  • Size: 152.9 kB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.5

File hashes

Hashes for zig_minesolver-0.1.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 04ccb6898883bf2b7b232225d80a780ebd3aa47c3818ff916580d68fdb840048
MD5 c25cb87efb211e8cf119dad5aac49d99
BLAKE2b-256 b65ab63c911f811874bcf578d0ea3079b882bb7f206d81b506d40c1aaa72d967

See more details on using hashes here.

File details

Details for the file zig_minesolver-0.1.0-py3-none-manylinux1_x86_64.whl.

File metadata

  • Download URL: zig_minesolver-0.1.0-py3-none-manylinux1_x86_64.whl
  • Upload date:
  • Size: 385.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.5

File hashes

Hashes for zig_minesolver-0.1.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 065bbb25c0ebc1306c422b9d4db5df2ed30fa4b15a54299f7d3faa07da7599ae
MD5 00d77a452ff08a94f2018a841fa51bc9
BLAKE2b-256 3794e4c8a2f3c30dccccf74157dbc754600eb899f47707194e6bca6ddcae4668

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page