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.2.3.tar.gz (78.1 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.2.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: queens_reasoner-0.2.3.tar.gz
  • Upload date:
  • Size: 78.1 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.2.3.tar.gz
Algorithm Hash digest
SHA256 04ff7489fee5e994dd72fc2a94b5459d7b043354728a2513b585395e1402d9d5
MD5 d237f78ec7c5521b65fdb3b472406ed9
BLAKE2b-256 6313ed32b172a688678d94cb215701871113711c2285d9be3c9d78114ea4fac0

See more details on using hashes here.

Provenance

The following attestation bundles were made for queens_reasoner-0.2.3.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.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for queens_reasoner-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 841c333554e137e9b5fc805a7b8f2b9e13fef7a2208e51271a6666c1f31b4258
MD5 c4a899ebbabb8798fe853ebd5002a2c2
BLAKE2b-256 5ae6f1dc71b3b76554b6fc44a02fe625d6808eb56040830a2f5f14540249b6d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for queens_reasoner-0.2.3-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