Skip to content

Latest commit

 

History

History
116 lines (61 loc) · 5.45 KB

File metadata and controls

116 lines (61 loc) · 5.45 KB

Hint walkthrough — example 6×6 puzzle

This is the full deduction sequence the solver produces for the example 6×6 puzzle shown in the main README. Each step below is one element of puzzle.deductions, in order, rendered the way a player sees it in-app.

The hints alternate between four rule families the solver applies in priority order:

  • row N can only have a star in {zone} / column N can only have a star in {zone} — single-row/column subset elimination. Every empty cell of that row/column lies in a single zone, so the row/column's star must go there; cells of that zone in other rows/columns can be crossed out.
  • {zone}, {zone} must have stars in rows N, M — multi-region pigeonhole. K zones whose remaining cells fit entirely inside K specific rows or columns must contain those rows'/columns' stars between them; cells of those zones outside the K-row/column band can be crossed out.
  • A star here would leave no options in … — cell-level hypothetical. Try placing a star at the highlighted cell, derive a contradiction (some row/column/zone runs out of empty cells), cross the cell out.
  • Last option in … — the dual. Every other cell in some row, column, or zone has been crossed out, so a star is forced here.

Each screenshot shows the board state after the deduction has been applied, with the affected cells highlighted in white.


1. row 3 can only have a star in {purple}

The purple zone is the only zone with empty cells in row 3, so row 3's star must lie in purple — every other cell of the purple zone (rows 1–2 don't have any) is fine, but the rest of row 3 outside purple is crossed out.

Step 1: row 3 can only have a star in the purple zone


2. column 5 can only have a star in {red}

Symmetric to step 1: red is the only zone with empty cells in column 5.

Step 2: column 5 can only have a star in the red zone


3. {blue}, {orange} must have stars in rows 1, 2

Multi-region pigeonhole. Blue's remaining cells live entirely in rows 1–2, and the only other zone with cells in rows 1–2 is orange. Together blue and orange must hold the stars for rows 1 and 2 — so orange cells in rows 3+ that fall in those columns can be crossed out.

Step 3: blue and orange must hold the stars for rows 1 and 2


4. {yellow}, {orange} must have stars in columns 4, 6

Same shape, applied to columns. Yellow's remaining cells live in columns 4 and 6; orange is the only other zone overlapping those columns. Together they own the stars for columns 4 and 6.

Step 4: yellow and orange must hold the stars for columns 4 and 6


5. A star here would leave no options in column 1

First cell-level hypothetical. Placing a star at the highlighted blue cell (1,1) would knock out the only remaining empty cell in column 1, leaving nowhere for column 1's star — contradiction, so cross it out.

Step 5: a star at row 2, column 2 would leave no options in column 1


6. column 1 can only have a star in {blue}

After step 5, column 1's only remaining empty cell is in blue. Single-column subset elimination fires.

Step 6: column 1 can only have a star in the blue zone


7. A star here would leave no options in {red}

Second cell-level hypothetical. Placing a star at the highlighted yellow cell (3,5) would force the red zone (which lives in column 4) to have no remaining cells.

Step 7: a star at row 4, column 6 would leave no options in the red zone


8. Last option in row 4

After steps 1–7, row 4 has exactly one empty cell left — the red cell at (3,4). A star is forced there.

Step 8: last option in row 4 — star placed in red zone


9. Last option in row 5

Same rule, row 5: only the green cell at (4,2) remains empty.

Step 9: last option in row 5 — star placed in green zone


10. Last option in {yellow}

The yellow zone has one empty cell left at (5,5).

Step 10: last option in the yellow zone


11. Last option in {purple}

The purple zone has one empty cell left at (2,1).

Step 11: last option in the purple zone


12. Last option in {blue}

Final star: blue's last empty cell is (0,0). The board is solved with one star per row, column, and zone.

Step 12: last option in the blue zone — puzzle solved


Notes

  • The {zone} placeholders in the rendered hints correspond to literal {zone_N} tokens in the underlying Deduction.reason strings (see speed_stars/deductions.py). The frontend substitutes them with colored square icons; this doc uses color names for readability.
  • The order matters: the solver always picks the simplest applicable rule at each step, which is why subset elimination (steps 1–4) fires before cell-level hypotheticals (5, 7), and forced stars (8–12) come last once enough cells are crossed out.
  • This is the same logic used to validate generated puzzles. A puzzle is shipped only if generate_deductions can produce a complete sequence like the one above without falling back to lookahead. See DESIGN.md for the full rationale.