Hacker News new | ask | show | jobs
by gus_massa 2081 days ago
Feature request: When I hit a hexagon with 0 it opens all the contiguous hexagons with 0, but it doesn't open the hexagons around it like the classic minesweeper. Can you add this?

Another more difficult: Can you add a zoom?

3 comments

Thanks! I actually did it that way on purpose. Reason being is that in multiplayer, you get points clicking around the blurry shape. So, competitive function with multiple players, and there's a risk of misclicking in the rush and nailing a mine.

I do however have an update coming up (sigh after this ... month ... eventually) which will address what you just said, and also try to make sure your first click always hits a hole. But not sure how it'll turn out just yet. I'm a romantic when it comes to random number generators so I didn't want to mess with a pre-generated board just to create a hole. Plan is to shift the entire board by X,Y tiles from where you click, and as you can imagine geometry of irregular shapes is a bit tricky.

Two things from clicking around on the beginner map:

- Sometimes I get zeros with mines next to them

- Like in OG minesweeper, it would be really helpful to be able to click/two-button click/mouse wheel click (whatever you like) on a number tile (whose mines have already been flagged) to clear all the tiles around it.

> ...also try to make sure your first click always hits a hole.

No need to muck with generation - first click always clears the clicked tile, then reveals.

Thanks, I'll put this as an option when creating a new game. As for myself, I definitely like the feel of nailing a larger crystal of empty space and get that Pavlovian sound.

What's funny is that most of the server code is already in place in dev, it's just disabled. I just need to carve some time to pick a direction and work on it. When a board is generated, there's already an algorithm that locates the center of the biggest empty space on a board, and if it exists, it assigns its address to game.clearest_tile.

    // first click, surprise!
    if( game.click_count === 1 && game.clearest_tile !== false ) {
        // sigh, this is too inelegant
        // game.board.private[payload.parameters.address].mine = false;

        // sigh, and this looks like garbage when shifted
        // this is what i get for picking a hexagonal board
        // game.shift_mines_to_center(payload.parameters.address);

        // todo: fixplz
    }
Obviously I can just clear that tile on that first click and be done with it. Or, highlight the emptiest tile on game board render. But the shift_mines_to_center algorithm is something that needs tweaking.
How long does it take to generate boards?

An alternate approach would be to repeatedly generate the board after the first click, till the board has a hole under the click.

Yeah, totally get your point. Generating one is inexpensive, maybe 1 ms to get it cranking. It's entirely possible that looping through untampered RNG combinations until a hole opens is more efficient than scrolling the field around.

The algorithm to locate the biggest hole on a 1,200 tile board takes around 45ms and I'm stubbornly itching to use it one way or another. But I'll see what's a more sane solution over shifting fields.

Also, oops, missed this part. There is zoom.

Unfortunately it requires mousewheel or some magic combination of your trackpad and pinch which, I just hate mobile and macs apparently. Key Z is to zoom-all.

I want to zoom in the other direction, because in the big maps the small numbers are difficult to read.
Oh, I think I get you. You mean the static HUD isn't doing anything for you zooming in the board. That's an oversight on my part, thanks for the report.

Edit: also, you should be able to zoom in on the tiles, but, you're possibly running into an untested edge case, of which there are tons. Mac and mobile is under-developed as I'm a firefox/desktop curmudgeon. As you and others have noted, there is some interface goofery, but otherwise a mousewheel should let you zoom in until you see a moire pattern on a crt.

I'm using Chrome on Windows. No mouse wheel. (I don't even have a mouse, just a touchpad.)
Gotcha. Thanks for taking the time to explain. I'll add some hotkeys (+/-) to initiate a zoom, but otherwise this is a result of my pure laziness.

Not that you can zoom like this now, but you can pan if you hold the ctrl key down and left - click + drag.

Zoom is mouse wheel, says on the front page.