Now that's what I call a well-spent long weekend
Over the past three days I've been putting together a Minesweeper clone to go in my puzzle collection. As of now, it seems to be pretty much playable.
To write yet another Minesweeper clone in this day and age, you have to have some pretty impressive added value to avoid accusations of gratuitous reinvention of the wheel. My added value is that I use sophisticated grid construction to ensure that all puzzles generated can be solved without needing to guess. No more getting to the last four squares and finding you have no choice but to take a 50-50 gamble.
What I hadn't realised before actually writing this and playing with it is that it permits much denser grids. The Windows ‘Expert’ level has a mine density of a bit over 1 in 5, and it's already sailing close to the limit: I've generally found it quite rare to get to the end of an Expert grid without having to take a nasty risk. If you tried getting any denser with random generation, you'd just have a vanishingly small chance of actually completing anything. But with my intelligent generation, you can raise the mine density by nearly another factor of two: I've successfully played games on the same size of grid (30x16) with 190 mines. At that density there are barely any blank areas to work round the edges of; almost the whole grid is taken up by fiddly work involving squares marked between 3 and 6, and there's no let-up. And it's fun.
Now I just need to find a way to go to sleep tonight without dreaming about Minesweeper…
no subject
no subject
So yes; I delay grid generation until the first click, and I arrange that (a) that square is free of mines, (b) none of its immediate neighbours have any mines in either so that it opens up a whole area, and (c) starting from that area it is possible to solve the whole of the rest of the grid without needing to guess.
no subject
no subject
no subject
no subject
no subject
no subject
no subject
no subject
no subject
no subject
no subject
no subject
no subject
no subject
Have you had any more trouble with instakills or guessing?
no subject
no subject
Although, if I may report a bug via LJ, it throws lots of compile warnings on Debian powerpc; it looks like mostly the plain
char-ness ofgrid, since adding-fsigned-char. You should be able to reproduce them elsewhere using-funsigned-char.no subject
no subject
There's an annoying UI difference between your version and the Windows version. I'm in the habit of pressing both mouse buttons while pointing at a number to clear the surrounding squares if there are already the appropriate number of mines marked; this is required by the original Windows implementation, a left-click on its own does nothing. In the original, if the number of marked mines is incorrect it 'presses' the surrounding squares down. In yours, this happens when the left mouse button is pressed, but they pop up again when the right button is pressed; the observed behaviour therefore depends on whether the intended simultaneous button press was actually left-right or right-left.
no subject
Mouse handling is done centrally in my puzzle framework, and as you observe the pressing down of one mouse button fabricates a button-up event for any previously pressed one. This is usually a good thing, though I concede that it isn't ideal for Mines. Feel free to submit a patch :-) The relevant function is
midend_process_key()inmidend.c. All it'd take would be a bit of configurability in that function and a set of flag bits provided by the individual game.no subject
no subject
Next bug report: click in the window, outside the puzzle area (under Linux):
mines: mines.c:1295: mineopen: Assertion `x >= 0 && x < ctx->w && y >= 0 && y < ctx->h' failed.
(More generally, clicking outside the puzzle results in strange "you've lost" states.)
no subject
Also the 'solvability' algorithm appears to have eliminated the need for several sorts of thinking about the correct answer though I may be wrong - it seems too easy.
no subject
It is true that verifying the grids with a solver restricts the required reasoning during play to only those things the solver was capable of. This is unfortunate, but it's that or have your perfectly good Expert game be destroyed on the final click by an unavoidable 50-50 guess; and there are plenty of implementations which provide the latter, so I thought I'd try something different. If you really want Mines to go back to being an ordinary Minesweeper you can always disable the intelligent generation.
no subject
1) Keyboard shortcuts don't appear to work. Specifically, when choosing the Specific... and Random Seed... options it would be nice to be able to just Ctrl-A Ctrl-C to copy the data, but that just beeps. Undo and Redo (which I noticed under Solo) would also be usefully bound to Ctrl-Z and Ctrl-Y. (I suppose even better would be to have a menu option to copy a complete game description - including code revision level I guess - to the clipboard for reporting poiposes.)
2) Is this intended to be solvable purely by logical inference? I'm down to the bottom left corner having started in the middle somewhere. Unless I'm missing something there are several choices from this position which don't result in a contradiction:
no subject
**1
#42
#2*
X22
no subject
no subject
Well, you're the Windows programming expert, you tell me how to fix it :-) I just instantiated a standard edit box and expected it to do the right thing. Is there some voodoo I have to apply to get standard keyboard shortcuts to start working? Or do I actually have to go through the sheer tedium of implementing them all myself?
Undo and Redo (which I noticed under Solo) would also be usefully bound to Ctrl-Z and Ctrl-Y.
Undo should already be on ^Z. I'd never noticed ^Y as a shortcut for redo before someone else mentioned it to me last week, but it's certainly not being used for anything else right now so I could perfectly well add it.
no subject
(Anonymous) 2005-05-31 03:30 pm (UTC)(link)no subject
Interestingly, I have a slight advantage over the built-in solver: I know that the grid is solvable and can use that to solve it. ;-)
no subject
Now, obviously, I'm a demon minesweeper player, and I never screw up, so this niggle is of absolutely no importance to me. But just supposing I were ever to make a mistake…
It would be nice if, when you stepped on a mine, some indication were given of where you went wrong. Ideally, at that stage, the following would be mutually distinguishable:
- Empty areas successfully uncovered
- Mines correctly discerned
- Places you said contained a mine, which didn't
- Mines you didn't find
- Empty areas you didn't uncover
- The mine you trod on
At the moment, 2 and 3 look identical, as do 4 and 5.no subject
The thing about my Mines is, it has an undo feature, because that comes as standard when any game is implemented as part of my puzzle collection. I nearly arranged to make the undo feature optional (disabled or enabled by choice of each individual game) on the basis that it didn't seem to make much sense for Mines, but at the last minute I was persuaded to turn Undo into a feature rather than a bug.
Hence, when you step on a mine, you only get told about the one mine you stepped on, which means it hasn't spoiled the rest of the grid for you - so you can press Undo and carry on playing, and the game will keep track of how many times you died. I think this is a much better response to death than to declare the game completely over.
(In particular, I might have considered that mechanism in itself to be an adequate solution to the problem of 50-50 guess sections if I'd thought of it first. I'm glad I came up with the intelligent generation algorithm first instead.)
If you do decide you want to see where the mines really were, there's always the "Solve" option on the game menu. It won't overlay that on your existing position, but you can Undo/Redo to switch back and forth between the two views and compare them.
no subject
Yes, I'm describing Windows Minesweeper. And probably Minesweeper more generally.
If you don't want configurability, maybe "solve" could show a comparison between where you'd got to before giving up, and the full situation, in the way other Minesweepers do when you die. Then people could choose to see that comparison whenever seemed appropriate — at first failure, or never, or somewhere in between as the mood took them.
Incidentally, as a minor user interface consistency issue, I regard the pencil marks in Solo, locking in Net and flagging in Mines as essentially the same activity: the user making notes to themself while solving the puzzle. It feels just subtly wrong to me that this is achieved using the right-hand mouse button in Solo and Mines, but the middle mouse button in Net.