You're reading the documentation for a development version. For the latest released version, please have a look at master.

queens_solver.parser

Functions

parse_queens_game(page[, mode])

Parse a Queens game board using the specified backend.

parse_queens_game_linkedin(page[, logger])

Parse a LinkedIn Queens game board into a sparse matrix.

Module Contents

queens_solver.parser.parse_queens_game(page, mode='linkedin')[source]

Parse a Queens game board using the specified backend.

Initializes logging and dispatches to a backend-specific parser. Currently supports the LinkedIn Queens backend only.

Parameters:
  • page (playwright._impl._page.Page) – Page instance of the Queens game page to parse.

  • mode (Literal['linkedin']) – Parsing backend. Defaults to "linkedin".

Returns:

CSR sparse matrix of the parsed board layout. Each entry holds the integer region/color ID for the corresponding board cell.

Raises:
  • RuntimeError – If the parser fails to locate or extract the board.

  • ValueError – If an unsupported mode is provided.

Return type:

scipy.sparse.csr_array

queens_solver.parser.parse_queens_game_linkedin(page, logger=None)[source]

Parse a LinkedIn Queens game board into a sparse matrix.

Extracts the rendered game board layout from the page HTML by locating the queens-board section and parsing each cell’s row, column, and color class (cell-color-X).

Parameters:
  • page (playwright._impl._page.Page) – Page instance of the LinkedIn Queens game page.

  • logger (logging.Logger | None) – Logger for progress and debug messages.

Returns:

CSR sparse matrix of the board layout. Shape is inferred from parsed row/column indices; each entry holds the integer region/color ID from cell-color-X.

Raises:

RuntimeError – If the queens-board section is not found in the HTML (e.g. user not logged in or page structure changed).

Return type:

scipy.sparse.csr_array