simont: A picture of me in 2016 (Default)
simont ([personal profile] simont) wrote2005-05-30 05:43 pm

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…

[identity profile] deliberateblank.livejournal.com 2005-05-30 04:48 pm (UTC)(link)
Of course you're very first move always stands a chance of going boom. Unless you delay generation of the grid until after you know which 1 square has to be blank...

[identity profile] damerell.livejournal.com 2005-06-01 03:04 pm (UTC)(link)
Are you sure? The first click is free in Windows 3's minesweeper.

[identity profile] feanelwa.livejournal.com 2005-06-01 03:50 pm (UTC)(link)
I distinctly remember getting boomed on the first click several times on one of my father's computers. I can't quite remember if it was 95 or 98 that one had, but it was ninety-something.

[identity profile] atreic.livejournal.com 2005-05-30 04:48 pm (UTC)(link)
Does that mean you get given the first square too? Or is there still that really annoying first guess in the system?

[identity profile] fluffymormegil.livejournal.com 2005-05-30 04:56 pm (UTC)(link)
.EXE! .EXE! .EXE!

[identity profile] deliberateblank.livejournal.com 2005-05-30 04:59 pm (UTC)(link)
.SCR! .SCR! .SCR!

[identity profile] teleute.livejournal.com 2005-05-30 05:05 pm (UTC)(link)
I ust own this game!! I love minesweeper, and this sounds considerably better :-)

[identity profile] teleute.livejournal.com 2005-05-30 05:15 pm (UTC)(link)
I just played the one you linked to on your website. Is it the most recent version? I was getting killed on the first click, and found a couple of places were I did get down to a 2x2 grid where I had to guess. Also, if you could make the cleared squares and the uncleared squares different colours, I at least, would be very appreciative ;-)

[identity profile] teleute.livejournal.com 2005-06-10 05:19 pm (UTC)(link)
I've just been playing r5936, which seems not to be having problems with instakills. I don't know whether it's just my computer, but I'm really not seeing any difference in the colours of covered and uncovered tiles. Looking at the M$ minesweeper, I notice that the covered and uncovered tiles are uniformly a medium grey, but that the uncovered tiles are framed more strongly than in your version. Possibly it's this difference which is confusing me.
cjwatson: (Default)

[personal profile] cjwatson 2005-05-30 09:53 pm (UTC)(link)
Ooh, you bastard. ETIMEDISAPPEARINGDOWNPLUGHOLE.

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 of grid, since adding -fsigned-char. You should be able to reproduce them elsewhere using -funsigned-char.

mines.c: In function `known_squares':
mines.c:581: warning: comparison is always false due to limited range of data type
mines.c:587: warning: comparison is always true due to limited range of data type
[...]

[identity profile] timeplease.livejournal.com 2005-05-30 11:10 pm (UTC)(link)
(Excellent implementation, by the way. But...)

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.

[identity profile] timeplease.livejournal.com 2005-05-31 11:07 pm (UTC)(link)
Excellent, that appears to do the trick.

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.)

[identity profile] naath.livejournal.com 2005-05-30 11:35 pm (UTC)(link)
When I played the big grid it had one square totally surrounded by mines (a corner as it happens) - one is sovable, two is not (unless both are the same). Just to check that it won't be unsolvable in that way.

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.

[identity profile] deliberateblank.livejournal.com 2005-05-31 02:39 am (UTC)(link)

Specific: 30x16:16,11,mf6d0d8c9cacdcc9bc9f7d860e2e3e6f0e6e6f9e8aba8ecafeefbb0f152a258191a499df69fdb63e06a69d465a66628696a727c4d2f6b717139f06e25
Seed: 30x16n99#683298348361933

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:

Image

[identity profile] ptc24.livejournal.com 2005-05-31 07:33 am (UTC)(link)
That 4 in the middle of the shot - it's adjacent to three mines already (* in the diagram below), and there must be one more in the two uncovered squares (# in the diagram below). Either position would satisfy the 2 below it, so the uncovered square south-west of the 2 (X in the diagram below) can be safely uncovered.


**1
#42
#2*
X22


[identity profile] deliberateblank.livejournal.com 2005-05-31 08:04 am (UTC)(link)
Ah yes, so you can.

(Anonymous) 2005-05-31 03:30 pm (UTC)(link)
Re keyboard shortcuts: Tab, Ctrl-C works for me.

[identity profile] sevenstring.livejournal.com 2005-06-03 02:39 pm (UTC)(link)
Nice one. Winning UI, and solvability helps a lot.

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. ;-)
gerald_duck: (rubberducky)

[personal profile] gerald_duck 2005-06-12 10:24 am (UTC)(link)
Oooh, fun! Good one; thanks.

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:
  1. Empty areas successfully uncovered
  2. Mines correctly discerned
  3. Places you said contained a mine, which didn't
  4. Mines you didn't find
  5. Empty areas you didn't uncover
  6. The mine you trod on
At the moment, 2 and 3 look identical, as do 4 and 5.
gerald_duck: (mallard)

[personal profile] gerald_duck 2005-06-12 12:01 pm (UTC)(link)
[Pops to fire up Windows Minesweeper for the first time in months…]

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.