Skip to main content

Solver for Queens game with reasoning

Project description

Queens Reasoner

Queens Reasoner solves "Queens" game hosted on linkedin with step-by-step reasoning as humans.

Installation

To install Queens Reasoner, first run one of the following:

# Using pip
pip install queens-reasoner

# Using uv
uv pip install queens-reasoner

Then, run this to install browsers for playwright:

install-playwright-browsers

Usage

The Queens Reasoner automatically loads the "Queens" game hosted daily. To call the reasoners, run:

queens-reasoner

The reasoner first loads the game, then solves it, and finally validates the solution on the hosted webpage. Positions of queens are marked by asterisks to the right of color index, while others are marked by "x". In contrast to Queens Solver ("queens-slvr", which solves the game with linear programming), you may see the step-by-step reasoning process with Queens Reasoner. An example output looks like:

2026-05-13 09:43:01,303 [INFO] queens_browser: Page loaded from: https://linkedin.com/games/view/queens/desktop
2026-05-13 09:43:01,515 [INFO] queens_browser: [Play game] button clicked
2026-05-13 09:43:01,548 [INFO] queens_browser: Tutorial screen escaped
2026-05-13 09:43:01,733 [INFO] queens_parser: [queens-board] section found
2026-05-13 09:43:01,739 [INFO] queens_parser: Queens game board parsed
[[1  1  1  4  5  5  5 ]
 [6  6  1  5  5  5  5 ]
 [1  1  1  5  5  5  5 ]
 [2  2  1  5  5  3  5 ]
 [1  1  1  5  3  3  3 ]
 [5  5  5  5  5  3  7 ]
 [5  5  5  5  3  3  3 ]]
2026-05-13 09:43:01,750 [INFO] queens_reasoner::single_color_masking: Color 2 eliminates the possibility of queens on 9 elements
[[1  1  1  4  5  5  5 ]
 [6  6  1  5  5  5  5 ]
 [1x 1x 1  5  5  5  5 ]
 [2  2  1x 5x 5x 3x 5x]
 [1x 1x 1  5  3  3  3 ]
 [5  5  5  5  5  3  7 ]
 [5  5  5  5  3  3  3 ]]
2026-05-13 09:43:01,751 [INFO] queens_reasoner::single_color_masking: Color 4 determines its queen, and eliminates the possibility of queens on 13 elements
[[1x 1x 1x 4* 5x 5x 5x]
 [6  6  1x 5x 5x 5  5 ]
 [1x 1x 1  5x 5  5  5 ]
 [2  2  1x 5x 5x 3x 5x]
 [1x 1x 1  5x 3  3  3 ]
 [5  5  5  5x 5  3  7 ]
 [5  5  5  5x 3  3  3 ]]
2026-05-13 09:43:01,755 [INFO] queens_reasoner::single_color_masking: Color 6 eliminates the possibility of queens on 2 elements
[[1x 1x 1x 4* 5x 5x 5x]
 [6  6  1x 5x 5x 5x 5x]
 [1x 1x 1  5x 5  5  5 ]
 [2  2  1x 5x 5x 3x 5x]
 [1x 1x 1  5x 3  3  3 ]
 [5  5  5  5x 5  3  7 ]
 [5  5  5  5x 3  3  3 ]]
2026-05-13 09:43:01,757 [INFO] queens_reasoner::single_color_masking: Color 7 determines its queen, and eliminates the possibility of queens on 10 elements
[[1x 1x 1x 4* 5x 5x 5x]
 [6  6  1x 5x 5x 5x 5x]
 [1x 1x 1  5x 5  5  5x]
 [2  2  1x 5x 5x 3x 5x]
 [1x 1x 1  5x 3  3x 3x]
 [5x 5x 5x 5x 5x 3x 7*]
 [5  5  5  5x 3  3x 3x]]
2026-05-13 09:43:01,758 [INFO] queens_reasoner::single_color_masking: Color 1 eliminates the possibility of queens on 2 elements
[[1x 1x 1x 4* 5x 5x 5x]
 [6  6  1x 5x 5x 5x 5x]
 [1x 1x 1  5x 5  5  5x]
 [2  2x 1x 5x 5x 3x 5x]
 [1x 1x 1  5x 3  3x 3x]
 [5x 5x 5x 5x 5x 3x 7*]
 [5  5  5x 5x 3  3x 3x]]
2026-05-13 09:43:01,760 [INFO] queens_reasoner::single_color_masking: Color 2 determines its queen, and eliminates the possibility of queens on 2 elements
[[1x 1x 1x 4* 5x 5x 5x]
 [6x 6  1x 5x 5x 5x 5x]
 [1x 1x 1  5x 5  5  5x]
 [2* 2x 1x 5x 5x 3x 5x]
 [1x 1x 1  5x 3  3x 3x]
 [5x 5x 5x 5x 5x 3x 7*]
 [5x 5  5x 5x 3  3x 3x]]
2026-05-13 09:43:01,761 [INFO] queens_reasoner::single_color_masking: Color 3 eliminates the possibility of queens on 1 elements
[[1x 1x 1x 4* 5x 5x 5x]
 [6x 6  1x 5x 5x 5x 5x]
 [1x 1x 1  5x 5x 5  5x]
 [2* 2x 1x 5x 5x 3x 5x]
 [1x 1x 1  5x 3  3x 3x]
 [5x 5x 5x 5x 5x 3x 7*]
 [5x 5  5x 5x 3  3x 3x]]
2026-05-13 09:43:01,762 [INFO] queens_reasoner::single_color_masking: Color 6 determines its queen, and eliminates the possibility of queens on 2 elements
[[1x 1x 1x 4* 5x 5x 5x]
 [6x 6* 1x 5x 5x 5x 5x]
 [1x 1x 1x 5x 5x 5  5x]
 [2* 2x 1x 5x 5x 3x 5x]
 [1x 1x 1  5x 3  3x 3x]
 [5x 5x 5x 5x 5x 3x 7*]
 [5x 5x 5x 5x 3  3x 3x]]
2026-05-13 09:43:01,765 [INFO] queens_reasoner::single_color_masking: Color 1 determines its queen, and eliminates the possibility of queens on 1 elements
[[1x 1x 1x 4* 5x 5x 5x]
 [6x 6* 1x 5x 5x 5x 5x]
 [1x 1x 1x 5x 5x 5  5x]
 [2* 2x 1x 5x 5x 3x 5x]
 [1x 1x 1* 5x 3x 3x 3x]
 [5x 5x 5x 5x 5x 3x 7*]
 [5x 5x 5x 5x 3  3x 3x]]
2026-05-13 09:43:01,766 [INFO] queens_reasoner::single_color_masking: Color 3 determines its queen
[[1x 1x 1x 4* 5x 5x 5x]
 [6x 6* 1x 5x 5x 5x 5x]
 [1x 1x 1x 5x 5x 5  5x]
 [2* 2x 1x 5x 5x 3x 5x]
 [1x 1x 1* 5x 3x 3x 3x]
 [5x 5x 5x 5x 5x 3x 7*]
 [5x 5x 5x 5x 3* 3x 3x]]
2026-05-13 09:43:01,767 [INFO] queens_reasoner::single_color_masking: Color 5 determines its queen
[[1x 1x 1x 4* 5x 5x 5x]
 [6x 6* 1x 5x 5x 5x 5x]
 [1x 1x 1x 5x 5x 5* 5x]
 [2* 2x 1x 5x 5x 3x 5x]
 [1x 1x 1* 5x 3x 3x 3x]
 [5x 5x 5x 5x 5x 3x 7*]
 [5x 5x 5x 5x 3* 3x 3x]]
2026-05-13 09:43:02,000 [INFO] queens_validator: Setting [queen] on row 1, column 4
2026-05-13 09:43:02,031 [WARNING] queens_validator: Skip setting [queen] on row 2, column 2, since the tile is not enabled
2026-05-13 09:43:02,084 [WARNING] queens_validator: Skip setting [queen] on row 3, column 6, since the tile is not enabled
2026-05-13 09:43:02,710 [INFO] queens_validator: Setting [queen] on row 4, column 1
2026-05-13 09:43:02,798 [INFO] queens_validator: Setting [queen] on row 5, column 3
2026-05-13 09:43:02,858 [INFO] queens_validator: Setting [queen] on row 6, column 7
2026-05-13 09:43:02,947 [INFO] queens_validator: Setting [queen] on row 7, column 5
2026-05-13 09:43:07,042 [INFO] queens_validator: Validation result: SUCCESS
[[1x 1x 1x 4* 5x 5x 5x]
 [6x 6* 1x 5x 5x 5x 5x]
 [1x 1x 1x 5x 5x 5* 5x]
 [2* 2x 1x 5x 5x 3x 5x]
 [1x 1x 1* 5x 3x 3x 3x]
 [5x 5x 5x 5x 5x 3x 7*]
 [5x 5x 5x 5x 3* 3x 3x]]

Apart from "single_color_masking", there are other reasoners. To see all of them, please run pytest -rP --log-cli-level=INFO for more comprehensive tests on the reasoners.

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

queens_reasoner-0.3.1.tar.gz (93.3 kB view details)

Uploaded Source

Built Distribution

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

queens_reasoner-0.3.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file queens_reasoner-0.3.1.tar.gz.

File metadata

  • Download URL: queens_reasoner-0.3.1.tar.gz
  • Upload date:
  • Size: 93.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for queens_reasoner-0.3.1.tar.gz
Algorithm Hash digest
SHA256 1821cb9beebfb50a385d8f943d8496941500a26e2339a14b5136caa0d9574049
MD5 5d5f769a24481c5e59abbe418f520053
BLAKE2b-256 d17edae76c569e326ef4aa1d9b7c3e4a73495bcb5a854aff6107f5fad6c40b80

See more details on using hashes here.

Provenance

The following attestation bundles were made for queens_reasoner-0.3.1.tar.gz:

Publisher: upload-pypi.yaml on zhuxr11/queens-reasoner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file queens_reasoner-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for queens_reasoner-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72b303fbdb3eb6e59d5af9c86105ffdf586ac75bf37eac6b3058b2d7bc72e1a7
MD5 da55eb48de60115bb4285b5b95479274
BLAKE2b-256 088400aae5c67fee4dcba6bb771e4707db00794e038289761efe6cdc44578171

See more details on using hashes here.

Provenance

The following attestation bundles were made for queens_reasoner-0.3.1-py3-none-any.whl:

Publisher: upload-pypi.yaml on zhuxr11/queens-reasoner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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