The hint button uses around 600 lines of javascript to try to solve it the way I would solve it.
Since I am only good enough to do easy Sudoku puzzles, the hint can only solve easy puzzles.
The Hint button will help on medium or hard puzzles, but repeatedly clicking Hint might not always work.
The Hint button tries two different algorhythms to find a hint:
Easy hint
Figure out all the possible values for each empty cell and displays the value of the first cell that only contains one possible value.
The possible values (GetPossibleValues function) for an empty cell are the intersection of the set of possible values based on that row, the set of possible values based on that column, and the set of possible values based on that box.
To see how easy hint was implemented, look at the EasyHint function.
Medium hint
This function runs if no easy hint was found.
It looks at all the possible combinations for the easy hint function closer.
It compares combinations for rows, columns, and boxes looking for a unique digit.
To see how the medium hint was implemented, look at the MediumHint function.
Hard hint
The Hint button doesn't always work on the Hard or Evil levels.
I wrote the easy hint and medium hint by looking at how I solve Sudoku and writing a program to do the same thing.
Since I can't solve the Hard or Evil level puzzles myself, I don't know what to tell the computer about how to solve it.
I'm not going to get good enough to solve it because Sudoku is a boring, mindless game.
I only played Sudoku because I was on a plane and had read all the interesting articles in the magazine in front of me.
This guy
wrote a Sudoku solver in Javascript that's better than what I put together.
I have seen Sudoku many times before I actually tried one, I always thought it would be more fun to write a program to solve Sudoku than to actually solve it with a pencil.
Here's a
real
Sudoku website.