# How my Sudoku Solver works ?

In this page I will explain the techniques my Sudoku Solver uses to solve Sudoku Boards and gives examples.

The Sudoku Solver use four main techniques to solve a board: Rewrite notes, Place numbers, Notes elimination, and Guess numbers.
Rewrite notes will be use only one time at the beginning (if chosen). The rest of the techniques will be use (if chosen) as many as needed in the order they appear in this page ( Place numbers , Notes elimination and then Guess numbers ).
Not all board require the use of all the techniques. Some require only the Place numbers technique (usually easy boards) while some won't be solved uses all the techniques (my Sudoku Solver use) and require using Guess numbers technique (evil boards).

## Rewrite notes

My Sudoku Solver rewrites all the notes on the board before try to solve it.
The reason is that after using Notes elimination techniques (see bellow) and changing some numbers on the board (place a number instead of an old number) it can be showing an error that doesn't really exists.

 Technique Look on a part. If the part don't contain number then for each number i (1-9) check if number i can be found in the same column, row or square of the part. If can't be found then place the note number i. ## Place numbers

There are two techniques my Sudoku Solver place numbers on the board:

 Technique #1 If the part contain only one note (number i) then you place that note (number i) at that part. Technique #2 Look on a row, column or square. If in the row (column or square) you can place the number i only at one part then place the number i in that part.  Part 6x4 have only one note - the number 5. So place the number 5 at part 6x4. In column 6 there is only one note of the number 6 at part 6x7. So place the number 6 at part 6x7.

## Notes elimination

There are three techniques my Sudoku Solver use to eliminate notes from the board:

 Elimination technique #1 Look on a row, column or square. If in the square (column or row), there is a part that contain at least two notes and both of them are shown only two times in that square (column or row) and there is another part the contain those two notes then remove all notes except those two in both parts. Elimination technique #2 Look on a row, column or square. If in square (column or row), there are two parts with two notes each and both have the same notes then remove those two notes from the rest of the parts in the same square (column or row).  In square 2x2, part 4x4 have two notes (3, 8) and both can be found only two times in that square and part 5x4 have those two notes (3, 8) and more notes (4) so removing the other notes (4). In square 3x3, there are two parts (7x8 , 7x9) that contain two notes and the same notes (1, 7) so removing those notes from the rest of the parts.

 Elimination technique #3 (Square) Look on a square. If in the square, the note number i can be found only at one column (or row) of the square then remove the number i from the rest of the parts in the same column (or row) of the board. Elimination technique #3 (Column/Row) Look on a column or row. If in the column (or row), the note number i can be found only at one third of the column then remove the number i from the rest of the parts in the same square of the board.  In square 3x2, note number 7 can be found only at the middle column of the square so removing the note number 7 from the rest of the parts in column 8 of the board - from part 8x2. In column 8, note number 8 can be found only at the middle third of the column so removing the note number 8 from the rest of the parts in square 3x2 of the board - from part 7x4 and part 7x5.

### Guess numbers

It is simple as it sound. The Sudoku Solver chooses a part on the board that doesn't contains a number and guess a number (one of the part's notes). If no error found after placing the number on the board then keep going (use other techniques or guess new number). Else go back and guess one of the other part's notes. If all part's options failed then stop.