5 ms·
Shameless plug time! Someone says "minesweeper", I post my implementation. It's an established ritual. Here go: http://www.ronilan.com/bugsweeper/ http://www.
by ronilan 9y ago
Shameless plug time!
Someone says "minesweeper", I post my implementation. It's an established ritual.
Here go: http://www.ronilan.com/bugsweeper/ http://www.ronilan.com/bugsweeper/
Few notes:
1. This is dated January 2014. It is a job interview homework.
2. The HN community has detected a bug and indicated that it should be fixed. That was done March 2017.
3. There are currently no known bugs.
4. The goal of the game is to find the unknowns.
5. No puns intended.
6. Code: http://www.ronilan.com/bugsweeper/js/bugsweeper.js http://www.ronilan.com/bugsweeper/js/bugsweeper.js
- Retr0spectrum 9y agoAt this point, you should probably write a bot to post these comments for you!
- ronilan 9y agoI spend hours every day refreshing HN looking for the keyword to appear (and secretly, I must admit, also hoping for the next episode In the "PG vs. Seahawks OL" show). If we start having bots do refreshing and posting for us, then bot will not only be taking our jobs, they'll be taking our hobbies!! Can't allow that!!!1
- j_s 9y agoIs this the most recent episode? http://www.geekwire.com/2016/seahawks-lineman-russell-okung-responds-paul-grahams-essay-inequality-startups/ http://www.geekwire.com/2016/seahawks-lineman-russell-okung-...
- mmanfrin 9y agoDitto -- but in the process of making my minesweeper implementation, I got a little sidetracked and ended up making it Conway's Game of Life (sadly with no input, just random seeds/observe): http://game-of-life-manfrin.herokuapp.com/ http://game-of-life-manfrin.herokuapp.com/
- blueblimp 9y agoThe 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.
- oerpli 9y agoI tried it with Firefox and the buttons don't work. No idea why.