3 ms·
> ...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.
by jagged-chisel 6y ago
> ...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.
- pp19dd 6y agoThanks, 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.
- vijayr02 6y agoHow 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.
- pp19dd 6y agoYeah, 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.