Open wtho opened 5 years ago
Thanks for reporting. Are you sure about that first click never triggered a bomb? I think I remember they would still trigger nontheless.
I also don't think that this is too much of an issue, since you can just restart the game immeadiately by pressing the R
hotkey. Technically you could just hover a cell and click it, see if it is a mine and press R and try again. I've added this originally for testing purposes but it was too convenient to be removed again.
Greetings fellow Berliner ;)
Yeah I am quite sure you could not click on bombs.
I tried to delay the map generation until the first click happens in here https://github.com/Knochenmark/minesweeper/blob/61d4aed95201a817aba04ef50c0935ae5a730a6c/src/mine-sweeper.tsx#L245-L250
adding something like
this.setState({
mineField: generateMineField(rows, columns, mines, clickX, clickY),
gameStatus: GameStatus.RUNNING,
});
and previously only generating an empty fake mine field, but somehow react sticks to the empty one and does not recognize the new mineField in setState. :confused:
Describe the bug When starting a new game, sometimes (especially on hard) the first click will already trigger a bomb. The fix of this would be a time-saver for power player.
To Reproduce
Expected behavior In the "original" windows minesweeper the first click could never trigger a bomb. I guess the map was either generated on this first click, or several maps were generated and the first one without a bomb on the clicked tile was then used.