4 ms·
The best minesweeper implementation is Simon Tatham's, because it guarantees a board that can be solved without guessing. http://www.chiark.greenend.org.uk/~sg
by blueblimp 9y ago
The best minesweeper implementation is Simon Tatham's, because it guarantees a board that can be solved without guessing.
http://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/mines.html http://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/mines...
That guarantee allows for playing with high mine counts, which would ordinarily be impossible way too often. The high mine count boards sometimes contain interesting deductions.
- bdamm 9y agoThis rendition of the game is amazingly satisfying. Thanks!
- Asooka 9y agoAdditionally, the board is generated on first click guaranteeing empty space where you click.
- niuzeta 9y agoHow does he guarentee it?
- Doxin 9y agoNormally you'd do that by quickly reshuffling the mines if you guess wrong, although he might've gone the route of checking if it's possible to get into a guess-only state during generation and regenerating the board until no such states exist.
- tim_hutton 9y agoThe source code (mines.c) is here: https://git.tartarus.org/?p=simon/puzzles.git;a=blob;f=mines.c;h=da4428c7eb400620cf3ea114e598935b4a82d4ab;hb=HEAD https://git.tartarus.org/?p=simon/puzzles.git;a=blob;f=mines... There is code for solving a grid using deductions in this section: https://git.tartarus.org/?p=simon/puzzles.git;a=blob;f=mines.c;h=da4428c7eb400620cf3ea114e598935b4a82d4ab;hb=HEAD#l278 https://git.tartarus.org/?p=simon/puzzles.git;a=blob;f=mines... And below that is the code that generates grids and checks that they are solvable without taking risks. A similar approach is used to analyse the difficulty of Sudoku games here: http://hodoku.sourceforge.net/en/index.php http://hodoku.sourceforge.net/en/index.php with different names for the different types of deduction.
- niuzeta 9y agoThank you so much! This helps so much.