Show HN: The classic Minesweeper on an irregular grid (polyreplay.com)

293 points by frading ↗ HN
I'm experimenting game mechanics that are usually seen on a typical grid, but transposed on an irregular one.

This is a first game based on Minesweeper.

The changes an irregular grid brings are that cells don't all have 8 neighbors. Some can have less, some can have more. So when you try and deduce if a tile has a mine, you have to pay closer attention at the number clues and which tiles neighbors it.

My intention is to make a very classic game a bit more challenging & fun.

I've also released a first version of Checkers/Draughts, and plan to test similar variants for Chess, Othello and Go.

142 comments

[ 2.8 ms ] story [ 177 ms ] thread
Neat... but I'm missing the left+right click, in the Windows Minesweeper, say you have a square with 4, and you've marked 4 squares around it as bombs, you can left+right click on the 4-square and uncover all the unmarked squares around it, instead of going one by one.

Also "undo" is cool, but "lose 60s" seems backwards, considering one would get 60 seconds added to one's time.

left+right click reveal works for me (linux + chrome 120). Middle click also does the same as left+right click.
Thanks a lot for trying it and the feedback. As a sibling comment said, left+right click should work (as well as middle click). Which OS/browser are you using? I like to fix this.

And you're right for "lose 60s", It's not the ideal wording. I was thinking it in terms of the less time you end up with, the better your score is. But "gain 60s" wouldn't work either. I'll have a think, but curious to hear if anyone has suggestions for this.

maybe "60s penalty" would be better wording?
yes, that's indeed better, thanks a lot for your help, I appreciate.
"60s penalty" wording is live! Thanks again
Middle click does not work for me on a Mac. Maybe cmd+click or double click would be ok to do?
Thanks a lot for the feedback and suggestion. And yes, I think it makes sense to add those.
Middle-click to progress works, but middle-click to flash (with no net effect, just so you can count) doesn't. This would really help work around the unintuitive neighbors problem mentioned elsewhere.
ah yes. I have not added that, but it's on my list. I completely agree it would help. I'll see if I can get to it. Thanks a lot for the nudge, that's super useful.
I'm using a trackpad, so I don't have middle-click or right+left-click – could you make a single-click or double-click on the number cause the clear?
I've just added left+Ctrl, does that work for you now?
(comment deleted)
No, holding down Ctrl and left-clicking on a number doesn't clear adjacent spaces in Firefox on my Macbook Pro.
(comment deleted)
Re wording: perhaps "costs 60s" might be sufficiently unambiguous?
thank you for your suggestion. I went with the "60s penalty" suggestion in the end.
I have a touchpad (and a crappy one at that), left+right click isn't an option, nor is middle click.

Left-clicking the number is an option, and works for touchpads where chording and middle-click just don't.

One "challenge mode" (entirely self-directed) for Minesweeper was to complete the board without flagging any mines. (Once you've revealed every non-mine space, all the mines get flagged automatically and you win.)

Disabling left+right click brings us a lot closer to that mode. Maybe you could formalize it and call it an option?

A much bigger problem with right click (and left+right click) is that it's bringing up the browser context menu. That shouldn't happen.

If we're trying to be authentic to original Minesweeper, I see that you've implemented the sunglasses face that appears once you've won the game. The original also uses an ":o" face (circular mouth) when revealing a hidden square. Maybe U+1F62E?

I didn't realise that completing a grid without putting any flag was a challenge people would take. That's very good to know, thank you. So yes, maybe I'll formalize it, that would make sense.

And I believe that the context menu appearing is only on MacOS? The closest I have is a mac book, and I can't reproduce the problem on it unfortunately. But it looks like I can reproduce it on linux/chrome, with the browser dev tools set to mobile, so hopefully that fix will also solve the problem on MacOS. I'll report back when that's deployed.

For the emoji, at the moment, you can see a scared face when you click on an uncovered tile, and take about 1sec to release the mouse. So when you're hesitating for instance. And I think I'm happy with how it is at the moment, I'll take care of all the other bugs mentioned here as a higher priority.

I'm used to double-clicking to perform the same action.
For touchpads that don't have a real Right mouse button, you can't Left+Right click at the same time. Windows Minesweeper adds Double click as an alternative way to trigger Clear Around.
ok, that's great info thank you. I should be able to fix that in the coming days.
Other touchscreen minesweepers let you tap the number to clear all the blank spaces around it if enough mines are marked. Without this feature, clearing is tedious.
Middle click works great for me, just like the ol' Windows 3.1 days.
> Middle click works great for me, just like the ol' Windows 3.1 days.

Two points:

- In Windows 3.1, Minesweeper had the convention of left+right clicking to uncover every non-flagged square around a number that was full.

- At that time, three-button mice were not so common; the mouse to my Windows 3.1 machine had only two buttons.

Middle click might have worked then, but it was not the primary way to get the effect.

I'd like to have the option to show "remaining" mines. I've played https://pwmarcz.pl/kaboom/ enough in "countdown mode" (i.e. where the numbers are the number of hidden mines) that I can't adjust to this....
On the left of the face emoji, in the top bar, you should see the number of remaining mines. It's not exactly like the version you linked, which should "number found / total", as what I show is simply "remaining mines". Is that what you mean?

Although the number I show is actually a bit sneaky, as I subtract the number of flags placed to the total number of mines. So if you were to place more flags than mines, you'd see a negative number. (which I realise as I type that your version is similar, as the number can also go above the total).

Actually I'm more interested in the game board. If a space has (say) 3 mines next to it, then the numeral 3 will appear (as today). However, when I add a flag next to it, then the count should go down to 2 -- i.e. the number is always the number of mines minus the number of flags. It takes a bit of getting used to when first using that mode, but it becomes much quicker after a while as there is no more checking that a cell with a '4' has 4 flags around it, so all the other adjacent cells are safe. The countdown rule means that a cell with 0 in it, all the open adjacent cells are safe (assuming that the flags are in the right place!!).
Interesting. Thank you for explaining, I understand now.

I'm more leaning toward not adding more options, as I'd like to keep the game as simple as possible, but nevertheless I'll have a think, it might be worth it.

Neat. Does this ensure there's no 50/50 guesses needed then? That seems easier when you can split a square in two.
It doesn't sadly. I had tried to implement that, but couldn't find a provable way to prevent 50/50. It's especially trickier as I can't use an algo with just rows and columns, it has to work on a graph. And it would need to be fast enough as to not slow the grid generation (which already takes a few seconds on the maximum size). So I'd love to add this ultimately, but not entirely sure I'll have the resources.
Also though they are rare, there are some nasty beginnings too, like this one: https://imgur.com/a/tjHg5if

I might be overlooking something tho.

ah yes, it's a nasty one. I can't see an obvious way to progress without luck either.
There are definitely ways to progress from here, but they may be more advanced?

The 1 SouthEast of the bottom 2 touches two tiles, and the 1 immediately West touches a superset of those two. The difference between the larger and smaller set must be clear. And you can go further off of that.

ah yes, very well spotted! as the dev, I should really have seen that.
You are overlooking something ;)

The 1s on the little concave bit mean you know where the nearest 2's second flag should go, even though you don't know yet where the 1 is. Then that gives you some to clear.

But also it’s not really a requirement, original Windows minesweeper doesn’t have that, so it’s kind expected to have to try your luck sometimes.
It makes the game way better in my experience(not having any probabilistic decisions to make). Once I started playing Simon Tatham's version I started picking up all sorts of tricks I hadn't thought of before, simply because I knew a solution must exist.
This is really cool. Fascinating how the intuition maps neatly onto this grid

As a notorious Minesweeper speedrunner I find the animation uncover animation when middle clicking to be a little slow as I find myself waiting it for it to finish for a second or so.

ah very interesting!

I've done quite a few iterations of the speed at which they get uncovered, and it's definitely tricky to nail down. I've tried to find a middle ground between something that's rewarding/satisfying (so should take 1-2 seconds, long enough to be enjoyed), but also doesn't block you (so should be instant). And that animation would need to very different if it's revealing 10 tiles or less, or 500+. I realize this still isn't quite right.

So thank you for saying that, I'll try and improve it.

An idea (not sure if it will work well) - how about uncovering fields with a "wave" rather than one by one? So instead of linear time, make it linear-by-distance time. First reveal the original tile, then its neighbours, then their neighbours, ... It should still feel pretty fluid, but faster.
If I understand correctly what you're describing, it's more or less what's happening now. But it may not look like it if you're on the beginner grid, and may only look good/better on the larger grids (either expert size, or custom with very large size).

But in short, when you uncover the first tile of this wave, at each frame I uncover only 1/60 of the total. So if you've uncovered 600 tiles, 10 should be uncovered on each frame, and it should be done in 1 second if your display is at 60FPS.

But if you uncover 60 tiles only, it will uncover 1 per frame, and that can look pretty bland. Could it be what you see? If that's the case, I believe (with a good 60% certainty!) that I mostly need to revisit the method when it's for a small number of tiles.

(comment deleted)
Yes, I'm on a small grid, so only see a "chain" of the boxes being uncovered one by one. It does feel pretty slow, even though I'm nowhere close to speed solving : - )
I've thought about what you said a bit more, and I think you meant it should accelerate with time? In any case, I've just done that and deployed it. So if you refresh the page, the animation should - hopefully - be less bland. Feel free to let me know what you think.
I think it's faster now. Thanks!
Cool, thanks for making it mobile-friendly—though on my (small) phone screen, the tutorial dialog covers half the play board and couldn't he completed. the actual game works fine.

Been awhile since I played actual minesweeper, but shouldn't revealing a tile with a number on it which otherwise has empty neighbors also uncover those neighbors? I could swear that's how the original works.

ah very sorry about the dialog being too large. Which phone have you used it on? I should really fix this.

I've tested on an iphone mini, and even though the dialog is quite big on it, so I should indeed try and shrink it, it doesn't prevent completing the tutorial. But it looks like I wrongly assumed this would be the smallest phone I could test it on.

And as far as I know, the empty tiles only gets uncovered if you uncover another empty one, so I followed this principle. If that was also the case when you uncover a number, this would reveal too much.

Not the user who made the original report, but I had the same problem. I got stuck on the second mine because the tutorial textbox covered that shape and so I couldn’t flag the mine.

iPhone SE, Safari

Very good to know. I'll try and reproduce this bug, thank you for this.

And if you're able to send a screenshot, that'll be super useful. As at the moment, when testing in chrome dev tools, with iphone SE selected, it looks like it doesn't display the right size of the phone (or maybe I've misconfigured the dev tools), as the dialog box doesn't prevent from completing the tutorial.

I love this, and it brings an interesting twist to an old favorite. What initially tripped me up is the cells at the points are considered a neighbor. Of course as I write that it makes perfect sense, but because of the irregular nature it's a bit harder for me to register them as such. Not a complaint, just an intriguing side effect of the irregular grid.
Yes, completely agree. It does take time to get used to it. And even after having playing many games of this one, I can still trip me up at times.
neat! I've wanted to add irregular grids to my infinite minesweeper. Playing your version, it definitely adds something. How do you generate your grid? Is it voronoi cells on top of blue noise?
Thanks a lot. And I've had some thought about making this infinite, but it's a bit harder!

The generation is inspired by what Oskar Stålberg has done for his game Townscaper. It is done with those steps: - start with triangles (ideally in an hexagonal pattern). - merge pairs of triangles into quads, randomly leaving some as triangles. - we subdivide both quads and triangles, and end up with quads only. - smooth the whole to get nicer shapes

It can be a bit abstract with just this list, so you can see some videos in my tweet: https://twitter.com/fradingue/status/1712218108826460428

I've also created a webgl engine to solve this type of procedural modeling for the web, and you can see 2 examples scenes where you can play with parameters that affect the shape of the irregular grid: - https://polygonjs.com/gui/irregular_quads/edit - https://polygonjs.com/gui/irregular_quad_relaxation/edit

Looking at the high scores, is that "." a decimal separator? Are those scores for the beginner difficulty "one and a half seconds"?
Sub 0.5 second is world record for normal beginner minesweeper. So, could be, yea.
interesting, I wasn't aware of that. Is there an official list?
Yea somewhere, I forget exactly

I played a bunch of minesweeper earlier and looked at the records, and still don't get how it's possible lol

Yes, you're correct, it's the decimal separator. I remember now that this is not international. I believe the comma is used in the US? Having grown up in France, I'm used to the dot.

And that score is indeed suspicious, although there are some protections to prevent cheating. Someone would have to be quite motivated to go around them. But it might be possible, as you don't need to flag all the mines in order to win, you can wind by just uncovering the non-mines. I felt this could be allowed as this is really the same outcome. But I can see that if you're really lucky, the mines are placed in a very convenient way, a quick win could happen. But I assume this can only happen on the beginner grid, not on the larger ones.

In any case, I'll reconsider this, and may force all mines to be flagged in order to win, that might be safer.

> In any case, I'll reconsider this, and may force all mines to be flagged in order to win, that might be safer.

That would make it less fun though, because an interesting variant is when you play without using flags.

fair enough. And yes, someone else mentioned here that it's indeed a challenge some players take. So that makes sense, I'll leave it as is. But maybe something's up with the score, or I should only save them for intermediate and expert mode? I'll have a think.
Excellent on iPhone 12 mini. Love it. Thank you for sharing!!

Q: Would it be possible to make the grids… even more random? What’s your gridding approach? I was almost a bit "disappointed" that the grids still looked like, well, grids.

Thanks a lot to you for the kind words, that's great to read!

And I explain the generation method in another comment, but here it is as well:

-------------------- The generation is inspired by what Oskar Stålberg has done for his game Townscaper. It is done with those steps: - start with triangles (ideally in an hexagonal pattern). - merge pairs of triangles into quads, randomly leaving some as triangles. - we subdivide both quads and triangles, and end up with quads only. - smooth the whole to get nicer shapes

It can be a bit abstract with just this list, so you can see some videos in my tweet: https://twitter.com/fradingue/status/1712218108826460428

I've also created a webgl engine to solve this type of procedural modeling for the web, and you can see 2 examples scenes where you can play with parameters that affect the shape of the irregular grid:

- https://polygonjs.com/gui/irregular_quads/edit

- https://polygonjs.com/gui/irregular_quad_relaxation/edit --------------------

So even though you're currently seeing a flat grid, it's all 3D under the hood. So I'm also considering having those grids on a sphere, a torus, or even a custom 3D model. I had done some earlier test: https://polygonjs.com/gui/minesweeper_torus_sphere/edit So it's technically possible, but there's more work to have this easy to navigate around, and to still look visually minimalist while still being pleasant.

If the steam version becomes profitable, I'll definitely explore those directions. I agree this can be stretched further.

Lol this kept me entertained for a bit. Found it a couple of weeks ago.

Hoping my number 1 ranking on Intermediate stays up a while.

I’ll need to see if I can crack that Expert high list.

Cheers

ah welcome back! For the scores, right now, they all keep accumulating on the same page, but I may do weekly/monthly lists, so previous highscores won't stay on the main page for too long.
Bug report:

https://ibb.co/Db44nWp

The orange arrows point to a cell that should show "2" but shows "1."

EDIT: Nevermind :-)

There are a lot of bugs in that screenshot
I think it's ok. One of the mine spots is incorrectly labeled. The spot that the upper orange arrow is touching is not a mine.
Thanks a lot for the feedback. Although I've received several bug reports like this, and unfortunately every time, it was the player who placed a flag incorrectly. So at the moment I'm more leaning to one of those 2 flags being incorrect. I think out of those 4 flags, the second from the top shouldn't have been placed.

But my assumption can certainly be wrong! To be sure, could you take a screenshot of a loosing screen? as all the mines will be revealed then, and we can see if the number is indeed correct or not.

Love it. It feels great, and I particularly like that you can left-right click on the numbers like a pro!
This is really cool. I have wasted far too many hours playing minesweeper and this adds a bit of challenge back to a game that's become a bit too mundane for me(I mostly play it to fall asleep now).

I will say though that it seems like the map ends up a bit empty, reducing the difficulty. Managed to get through the expert setting without encountering a single 5, for instance.

And a question: Does this generate maps where guessing is necessary, like the original? I didn't come across any, and I was curious whether that was by accident or design. I hate those situations in what is supposed to be a logic game.

Great work!

Thanks a lot! And yes, the ratio of mines vs clear tiles may not be optimal, and is currently completely random, so guessing may be required at times. But there's an undo button so you won't have to restart a new level if you hit a mine.

But I'd love to remove guessing ultimately. I just haven't found a reliable way to make it work yet, and would need to dedicate a fair amount of hours to it, which I've preferred allocating to the other games on my roadmap. Nevertheless, it still may happen.

Could you maybe try the custom settings? You can change the ratio of mines. I'd be curious to know what quantity of mines you find works best.

Simon Tatham has a completely guess free minesweeper in his portable puzzle collection: https://git.tartarus.org/?p=simon/puzzles.git;a=blob;f=mines...

The basic idea is he generates a grid, runs it through a deductive solver, and if it fails, heuristically changes the grid a little where it failed and tries again.

I'll try some different ratios and get back to you!

edit: I tried some runs with size 3 and 20% mines, that felt a lot more like expert difficulty Minesweeper too in terms of the sizes of the empty patches you uncover by uncovering a 0.

Thanks a lot for taking the time to check this, that's very useful info.

Although the reason I haven't set 20% as the default, is because I'm concerned this may create too many situations where guessing would be required. So I'd need to have the solver in place. So thank you for the link as well.

Although now, I'm wondering if the solver can be smart enough to allow situations like this, where finding how to progress isn't quite obvious, like this one: https://news.ycombinator.com/item?id=39234686

Yeah, I did eventually run into a few guesswork situations. But besides those, it was a lot of fun. On the 20% I really had to stop and think, because all the logic I already knew was there, but subtly different due to the number of neighbours, so new patterns emerged that I had to re-deduce. Still haven't successfully solved one! most of the guesswork I've had to do was around the edges. Maybe going somewhat down from 20% in total and having a smaller percentage around the edges could be a useful temporary heuristic until a potential solver is in place.

I also spotted a bug I think, where when you fail and undo, some of the mines are rendered similar to an empty cell, thereby spoiling where they are. This was on Firefox.

I couldn’t beat the tutorial on iPhone SE, the modal text covers where the game needs you to click
Thank you for letting me know.

Would you be able to take a screenshot?

I'm testing for the iPhone SE using chrome dev tools, and the display seems fine there, so what I see it most likely not accurate.

Okay, I was able to progress, it's just a really small target to touch on screen. Though to be fair, probably a larger target than most advertising close X buttons.

https://ibb.co/t4KjqtK

This is fun. I was playing classic minesweeper the other day and remarked on how I was basically playing on autopilot, I've internalized all the logic and playing is just muscle memory now.

But playing this version, my intuition is all wrong! I lost my first 2 games, and now I'm going to have to force myself to slow down and think through things more carefully, rather than trying to rely on my now-incorrect intuitions.

That's great to hear, thank you! And yes, that's exactly the intention, it's a game designed to keep you on your toes.
This is great!.

You know what would be fun, side scrolling mine sweeper - the field just keeps clicking several spots to the left each N seconds revealing new tiles to click - and maybe things like "Bomb Squad" perks that let you survive bomb damage when youre wrong. and whatever other mechanics could be layered into that - if you can get some tower defence mechanism where a shooting tower comes at you and you have to enclose it in toggle spots to kill it.... but it hops a few spots every time the field clicks to the next step... making him hard to catch.

Get bomb squad points every time you get a correct answer, answer so many in a row, get a bomb suit (outlive one bomb). Get more point for the least number of unclicked tiles that expire to the scrolling of the field to the left... if you dont have any un-marked tiles moving through the filed moving click, then you get bomb squad points to next bomb suit.

ahah, wow. I love when someone finds new ways to expand on game mechanics. I'm trying to visualize what you're describing, and I think I see some correctly, and it does sound fun.

That'll make me think, certainly.

i have been thinking about using a real city map as a grid. each building and each open space is a block. that would make for some interesting challenges, especially when the blocks are colored like a real map. would fit well with the bomb squad idea. although i would design fictional cities, as a real city might make people feel uncomfortable given real bomb threats happening in some places
This is a really cool idea.

If you have a Fantasy city which is these weird polygons - you could make some great themes on cities - What if you will have creeps coming from Your Occupied side of the map, and you have to identify the snipers in the buildings in order to create a safe pathway throgh the city for your creeps... (tower defense style) as you reveal in a click-through fog-of-war manner, when you reveal swaths of "streets" as you click, it will allw creeps to have a safe or not path - and you have to be able to click a safe path fast enough before youre creeps get sniped...

(now, if you want to make it super controversial with a viral hope; They are refugees attempting to escape a war torn sci-fi city as they are caught in the crossfire of to warring factions... the snipers dont shoot at the refugees, per se, they shoot across the path at eachother, and if the refugees have only that revealed path to run through - they wil get shot, so as long as you keep revealing safe routes, they will follow that, but if they reach fog or a revealed sniper alley, they will still take the sniper alley unless you safely de-fog a safe passage. Sometimes tanks roll down an alley and they will be turned to Student Burgers if they get caught by the tanks...

---

You could do a multi-player version, which could be similar to https://GENERALS.io [0]

https://i.imgur.com/cUZ3kW1.png

https://i.imgur.com/k08X89r.png

The thing with this version is corners also count as touching. The different numbers of neighbors itself isn't confusing, but counting squares that share a single point as neighbors is definitely unintuitive.

Edit: Oh shoot, I completely forgot regular minesweeper does this too! It's definitely the acute angles that threw me off!

Regular minesweeper counts these too, but the different shapes definitely make it harder!

I found it much harder to register two acute angles as "adjacent" than two right angles are.

(comment deleted)
You might enjoy Bombe (on Steam) it’s all about Minesweeper automation and it gets to absurd levels.
I think Battleship on a hex or irregular grid could be more interesting than a regular grid.
https://polyreplay.com/minesweepertwist?p=expert&s1=7&s2=43&...

opening a shared url like this doesn't seem to work. i just get the beginner view.

also i noticed that sometimes a tile is empty or white even though it should have bevels because there is actually a bomb under it. it's a cosmetic issue maybe caused by the algorithm to automatically uncover empty tiles.

ah, that share url is indeed a bug, thank you for finding it, I'll work on it.

For the tile not having bevels when it should, would you be able to take a screenshot? That will help me understand when this happens. I haven't seen this yet, so I'm not entirely sure what could cause this.

I’m not sure why but that was the first game of Minesweeper I’ve ever finished, other than the ones I try to finish on huge maps with a single click.
I had totally forgotten how fun and sometimes nerve-wracking even when your reasoning is sound this game is. I wonder how much they would charge on steam if this game was novel. This implementation is also really fun.
Nice twist to it! I can't play it on autopilot like the original. And that is a good thing.

I really like these kind of games. They are so meditating.

Excellent, great to hear, I really appreciate.
MacOS, Safari: Tutorial breaks when I am asked to right click a cell, I just get the right click menu instead.

MacOS, Firefox: Tutorial halfway breaks when I am asked to right click a cell, I get the right click menu over a flag being dropped.

MacOS, Chrome: what the fuck the OS popped up a note when I launched this piece of surveillance capitalism adware that it just force-added a bunch of shit that runs in the background to my Login Items, fuck Chrome, anyway the right click actually works

Looks like a few people mention the context menu displaying on some browsers. I'll take a proper look at this, thank you for mentioning it.