nickarocho / minesweeper

The classic game with the classic look (Client-side Game) | HTML, CSS, JavaScript, recursion
https://nickarocho.github.io/minesweeper/
63 stars 27 forks source link

False Positive for solving puzzle #4

Open JFed-9 opened 2 years ago

JFed-9 commented 2 years ago

I'll attach a screenshot. I was guessing where the last two mines could be, got one right and one wrong. As I was clicking through the safe tiles, it said I finished the game, but one of my flags was incorrect. If you look closely at the bottom right, there's a 3 with 4 flags next to it. The flag should be on the box below it.

image

lolaswift commented 1 year ago

any idea how to fix this?

JFed-9 commented 1 year ago

To be honest, I haven't had a lot of time to go over your code (which is impressively concise and elegant by the way). But if I were to guess, it has something to do with the flagging/revealing functions. The win check is fine, it should work as expected. But just now as I was testing, I had another experience where there was one mine and one free space left, I flagged the free space and unflagged a random mine, and it decided to click the unrevealed mine and lose the game. I can't quite put my finger on it, but the flagging/revealing functions are what I would look into.