Hasty Briefsbeta

Bilingual

Writing a soluble-grid generator for Mines

a day ago
  • The author's Minesweeper implementation, Mines, guarantees every grid is solvable without guesswork, using a solver that simulates human deduction.
  • The generator does not rely on a mathematical characterization of solvable grids, as such a rule would overly constrain layouts and reduce gameplay variety.
  • Instead, the solver works alongside a 'perturber' that makes small mine rearrangements when the solver gets stuck, allowing progress without restarting from scratch.
  • Perturbations are not guaranteed safe; they may introduce new blockages, especially near the end, so the grid is re-checked by running the solver again.
  • If the solver fails after perturbations, the process iterates with more modifications; if things worsen, the grid is regenerated entirely from scratch.
  • The heuristic approach works well enough to support over twice the mine density of standard Windows Minesweeper, which surprised the author.