jozsefsallai / discord.js-minesweeper

Generate Minesweeper mine fields using Discord's spoiler tags.
MIT License
16 stars 4 forks source link

Allow always starting from zero cell if possible #7

Closed petzku closed 4 years ago

petzku commented 4 years ago

At least newer versions of minesweeper usually guarantee your first square is a zero cell, and automatically reveal all cells around any zero cell the player clicks on. While the latter can't really be done with discord spoilers during the game, forcing a start from zero is possible (assuming a zero cell exists), and pre-revealing cells from that point is as well.

This PR adds an option, zeroFirstCell, which will enable both of these behaviours. It is by default set to true, but won't do anything if revealFirstCell is false.

Currently there is no option to disable the recursive reveal feature, as I didn't consider it necessary, but it would be easy to implement if desired.

If there are no zero cells in the grid, this automatically falls back to the normal behaviour (i.e. revealing a random SafeCell).

jozsefsallai commented 4 years ago

Thank you!