Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Allow guessing if a square only ever can be revealed by guessing in the future #7

Open
kaldonir opened this issue Nov 26, 2019 · 9 comments

Comments

@kaldonir
Copy link

Think of the following scenario:

minesweeper

I set up a board for which there are two uncertain squares left, and one certainly safe square. In this scenario, continuing with the safe square and finishing the rest of the board before continuing in the bottom left can never change the fact that I need to guess which of the two bottom squares is a mine.

As it is now, I need to wait until there are no certainly safe squares left in completely independent parts of the board, before continuing with a part of the board that's actually already solved.

Without spending a lot of thought on how to compute / implement this, and on the consequences of such a feature, I'd suggest to allow guesses on uncertain fields that are independent of still unrevealed certainly safe squares.

@pwmarcz
Copy link
Owner

pwmarcz commented Nov 26, 2019

  • I can see some nasty corner cases: sometimes, even isolated areas might become certain late in the game, because the number of mines is fixed and there is just N mines left.

  • I would be worried about the game rules becoming more complex for the users - the rule that "you can guess whenever there is no safe square" is simpler, and already there are corner cases.

Maybe if I ever get to using a different solver that would make this easier...

@kaldonir
Copy link
Author

  • I can see some nasty corner cases: sometimes, even isolated areas might become certain late in the game, because the number of mines is fixed and there is just N mines left.

By intuition (which may be wrong), I'd say except for trivial situations you'd need to enumerate all possible solutions for the rest of the board to be sure that a square is actually uncertain.

  • I would be worried about the game rules becoming more complex for the users - the rule that "you can guess whenever there is no safe square" is simpler, and already there are corner cases.

Agreed. From a player's perspective this could get really confusing. But from the (mostly theoretical) perspective of "I am only allowed to click on uncertain squares if I have to", such a feature would be pretty cool.

@zaphod77
Copy link

zaphod77 commented Sep 8, 2021

Here are my heuristics i'd use for determining where you can guess.

  1. you may ALWAYS click on green squares. This rule is inviolate.

  2. if an area is all yellow, and it's surrounded by revealed and red squares, AND each yellow square is adjacent to a number, then guessing is required to solve that area, and we may guess there even if there is a safe square elsewhere. This heuristic is perfect. In this case, the number of mines is known, but the position cannot ever be. Were you playing real minesweeper, you would make the guess as soon as you know it is required. This should not punish you. If the are is not isolated, then solving elsewhere may give more clues, and we can't guess yet unless we are out of greens. If the area is isolated, but not all yellow, then we don't know the number of mines in the area, and must solve elsewhere if it's safe to do so, but may still guess if we are out of greens as usual. This rule has higher priority than the two below. If this rule says you can guess there, then you can guess there, even if other yellows or clicking off boundary is safer. These are safe yellows until you click one of them. It is possible that a square may end up unresolvable if more is revealed, but until we know as a player that guessing is required there, we shouldn't be allowed to guess yet.

  3. if there are no safe squares, then we must click a safest available guess on a yellow square. Let's say we have two corridors. not uncommon in a high mines game. One is a 6, and one is a 5. four of them are red cells, one is revealed, and three are left. The guess on the six is a 1 in three chance, while the guess on the 5 is a 2 in 3 chance. we should punish the player for abusing the safe guess mechanic and clicking by the 6 (which is more likely to be a mine than a safe square) when they could click by the 5, which is less likely to kill you in vanilla. Sometimes a yellow square may be seen by two or more different numbers. In this case, we use the worst one the square is seen by to determine. Let's say a square is seen by one number as a group of 2, and another number as a group of three. as seen by the group of two, it has a 50% chance of mine. but as seen by the group of three it has a 33% chance of mine. That square's mine chance is 50 percent. the squares of the group of three that do not overlap it have a chance of 33%. we must guess one of the ones that's in the group of three, and not the group of two. In a real game of minesweeper you would click a square that has the lowest chance of being a possible mine, and this is NOT currently required. You may guess one of them, even if rule 2 makes a guess safe elsewhere. The ones ithe hae no safer squares are safe yellows for now.

  4. if there are no greens, AND clicking clear is safer than clicking yellow, then you should be able to click clear safely, and you should be punished for clicking yellow. Place as few mines as possible on boundary, then divide remaining mines by remaining off boundary cells. This gives us chance of clicking a mine if we click off boundary, and we can compare to all the boundary clicks. This means there are no safe yellows, except for the ones by rule 2, which overrides this.

This way, we use the same strategy as we would with normal minesweeper, but we won't get screwed.

@zaphod77
Copy link

i guess this is abandoned? maybe i should fork and try to fix it?

@pwmarcz
Copy link
Owner

pwmarcz commented Nov 17, 2021

Hi. By all means, go ahead and fork - good luck trying this out!

(It sounds like your idea for Kaboom rules is quite different to what I had in mind, so I probably won't be interested in merging, but I'll be happy to link to your version if you end up publishing it).

@zaphod77
Copy link

zaphod77 commented Nov 17, 2021 via email

@j12i
Copy link

j12i commented Apr 3, 2023

I had no spoons to read the long comment by zaphod77, but here is another example of an independent (from other clauses) puzzle, and in this case too (like in kaldonir's), the solution is independent of the number of remaining mines. So it would be a nice convenience to be able to guess there immediately, instead of having to remember to go back there when there are no "green" tiles.
Screenshot_2023-04-02-23-28-05

@zaphod77
Copy link

zaphod77 commented Apr 3, 2023

yeah, my heuristic would detect this easily, and permit the guess.

the four yellow squares at the bottom right are all adjacent to a revealed square, have no safe squares by them, and are on boundary. This means that guessing is required to solve the area.

I don't believe there is any corner case to be found, since every example of "number of mine left resolves area" I can think of has at least one off boundary square, which is potentially resolvable when the number of mines in the area is known.

@j12i
Copy link

j12i commented Apr 3, 2023

I don't believe there is any corner case to be found, since every example of "number of mine left resolves area" I can think of has at least one off boundary square, which is potentially resolvable when the number of mines in the area is known.

I don't think so. If I encounter a counterexample, I'll get back here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants