Sunflowers: A Logic Puzzle Game and its Difficulty Engine

Sunflowers: A Logic Puzzle Game and its Difficulty Engine

Sunflowers is a logic puzzle game that challenges players to place flowers (or marks of absence) based on numerical clues. Described by its creator as "Reverse Minesweeper," the game's core appeal lies in its rigorous difficulty tuning system, which ensures that each puzzle's difficulty tier is defined by the same logic engine that powers the in-game hints.

The Logic Engine and Difficulty Tiers

The game employs a solver that plays through every generated grid end-to-end, taking the simplest available move first. The difficulty tier is determined by the hardest reasoning technique the solver must use to complete the puzzle. There are five distinct tiers:

Basic (Easy)

A puzzle is categorized as Easy if a single clue can settle its own squares. This occurs when a clue is already satisfied or has exactly as many unknowns left as flowers it still needs.

Subset (Medium)

Medium puzzles require the use of subset deductions. This happens when two clues are compared, and every unknown square seen by one clue is also seen by the other. By subtracting one clue from the other, the player can determine the status of the squares only the larger clue sees.

Overlap (Hard)

Hard puzzles require overlap deductions, where two clues share some squares. Min/max bounds on the shared region allow the player to settle the squares only one clue sees. Hard grids are guaranteed to include at least one subset move.

What-if (Extreme)

Extreme puzzles introduce "What-if" moves—a form of forcing chains similar to those found in Sudoku. The player hypothetically plants a flower or a cross in a square and follows the logic to see if it leads to a contradiction (e.g., a clue is broken). The contradiction proves the square must be the opposite value. To keep these mentally trackable, chains are capped at a few counting steps (MAX_WHAT_IF_FIRINGS).

Beyond the Cap (Insane)

Insane puzzles are the most difficult, requiring what-if chains longer than the Extreme cap (INSANE_CHAIN_FIRINGS) and the "either-way" technique. The either-way technique involves testing a pivot square both ways; if both hypotheses result in the same value for another square, that square is proven regardless of the contradiction. This is the one tier where taking notes is highly recommended.

Grid Generation and Scoring

To ensure consistency, the game uses a specific scoring system (0–100) to place a grid within its tier's band:

  • Easy (4–19): Based on how wide and forgiving the solve is.
  • Medium (20–39): Based on the count of forced subset moves.
  • Hard (40–59): Based on the count of forced overlap moves.
  • Extreme (60–79): Based on the total depth of what-if chains.
  • Insane (80–100): Based on the combined work of both branches of every either-way pivot.

User Feedback and Community Insights

Community members on Hacker News have praised the overall design and UI, but some have pointed out potential areas for improvement.

"I love it. Reverse minesweeper describes it perfectly."

Some users found the naming "Reverse Minesweeper" confusing, arguing that the same logic is essentially what is the core of Minesweeper, while others noted that the game is similar to other existing puzzles like "Mosaic" (also known as Fill-a-Pix or Nonograms) and "0h h1".

Technical feedback included requests for a dark theme, mobile responsiveness (scrolling issues on smaller resolutions), and quality-of-life improvements regarding the input method for placing flowers versus crosses.

Estimated Solve Time

The game's engine calculates estimated solve times based on weighted costs for each deduction type:

  • Routine marking: ~1 second per square
  • Basic deduction: ~2 seconds
  • Subset deduction: ~14 seconds
  • Overlap deduction: ~26 seconds
  • What-if deduction: ~15 seconds + ~10 seconds per step
  • Either-way deduction: ~35 seconds + per-step costs for both chains

Sources