ogarcia / opensudoku

Open Source Sudoku game for Android.
GNU General Public License v3.0
328 stars 144 forks source link

How to make a hints #26

Closed igupshup closed 5 years ago

igupshup commented 6 years ago

Please tell how to make hints? Actually i want a hint section where user hit the hints button and get correct value

steve3424 commented 5 years ago

I have a solver feature that could easily be adapted to do this

ogarcia commented 5 years ago

@steve3424 that is a great idea, use the solver to fill only the selected cell

steve3424 commented 5 years ago

I could work on this, but there are a couple scenarios to consider first:

What if there is a mistake in another cell that shows up when the hint is added? It will look like the solver made a mistake. Should there be a message?

If the cell is already filled with an incorrect value should it correct the value and display a message? Or if it is filled with a correct value should it just display a message saying the value is already correct?

Maybe there are also others that I am not thinking of as well.

ogarcia commented 5 years ago

I see two possible scenarios:

Scenario one, a perfect world where the user has no other fails and all puzzle is well filled:

When the cell are filled and you ask for a hint I see two options:

  1. If the value is correct display a message saying that the value is correct.
  2. If the value is wrong, display a message warning about it and correct value.

And finally, If the cell is not filled simply fill it.

And scenario two, the user has wrong values in other cells:

I think it could show a similar message to when it cannot solve a puzzle because other cell is wrong.

Or more elaborated, if the solver cannot solve because there is a mistake in any cell, try to solve puzzle starting from the beginning, show a message telling what filled cells are wrong and fix it. But this may be a lot of work I think.

steve3424 commented 5 years ago

That sounds great! I have an idea about how to show which cells are wrong. I am a bit busy at the moment but will get to work on this over the next few weeks.