Visual Basic program VB Sudoku - Program Descriptionn

Description cnt2 mode

In order to solve a Sudoku you can use a set of 16 rules. All these Sudoku's are relative simple. When those 16 rules are not enough the next strategy is by try and error. That means you try something and next you use the 16 rules to solve the Sudoku. When this is does not solve the Sudoku you try something else.
The simplest strategy is when you try the situations when there are two possiblities. For example when an array contains the numbers 1 to 7 in that order than you know that the missing numbers are 8 and 9. That means at position 8 you first try the number 8 and than when you get an error indication you try the number 8 at position 9.
Because you get an error indication at position 8 you know that position 9 must be correct otherwise the Sudoku is wrong.
However when you use the number 8 at position 8 it is also possible that you still can not solve the Sudoku. In that case you have to search for an other case whith two possiblities.
The parameter auto_cnt_2 in program Main
• When this parameter is 1 this is called the automatic mode. That means the solution is found without any operator intervention.
• When this parameter is 0 this is called the manual mode.

Condition AUTO 1 vertical

 ```0 0 0|9 1 3|0 0 0 0 0 0|7 0 0|0 0 0 0 0 0|0 0 0|1 0 7 ----------------- 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|6 8 7|0 0 0 ----------------- 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|3 7 5|0 0 0 ```
The missing number is the value 7 at x=2 y=4
The number is calculted based on the columns 4,5 and 6 and row 2.
The parameter cnt = 1

Condition AUTO 2 horizontal

 ```0 0 0|0 0 0|2 5 0 0 0 0|7 2 0|0 0 0 4 0 2|0 0 0|0 0 0 ----------------- 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ----------------- 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 2 ```
The missing number is the value N=2 at x=1 y=7
The number is calculted based on the rows 1,2 and 3 and column 9.
The parameter cnt = 1

Condition AUTO 3 vertical

 ```0 0 0|9 1 3|0 0 0 0 0 0|7 0 0|0 0 0 0 0 0|8 0 0|0 0 0 ----------------- 0 0 0|2 0 0|0 0 0 0 0 0|5 0 0|0 0 0 0 0 0|6 8 7|0 0 0 ----------------- 0 0 0|1 0 0|0 0 0 0 0 0|4 0 0|0 0 0 0 0 0|3 7 5|0 0 0 ```
The missing number is the value N=8 at x=3 y=4
The number is calculted based on the values in column 4.
The parameter cnt = 1

Condition AUTO 4 Vertical type 1

 ```0 0 0|9 0 0|0 5 0 0 0 0|7 0 0|0 8 0 0 0 0|8 0 0|0 9 0 ----------------- 0 0 0|2 0 0|0 4 0 2 0 0|5 4 1|0 7 0 0 0 0|0 0 0|0 2 0 ----------------- 0 0 0|1 0 0|0 3 0 0 0 0|4 0 0|0 0 0 0 0 0|0 0 0|0 6 2 ```
The missing number is the value N=7 at x=5 y=8
The number is calculted in column 7, based on the values in row 5
Column 8 contains the numbers: 2,3,4,5,6,8 and 9. The two missing numbers are 1 and 7. These values are stored in the array bb()
Row 5 already contains the number 1, that means the only number possible at position 5 in column 8 is the number 7
The parameter cnt = 2

Condition AUTO 4 Vertical type 1 - special circle

 ```0 0 0|0 0 0|0 0 0 0 0 0|7 0 0|0 0 0 0 0 0|8 0 0|0 0 0 ----------------- 0 0 0|2 0 0|0 0 0 0 0 0|5 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ----------------- 0 0 3|1 0 0|0 0 0 0 0 0|4 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ```
The missing number is the value N=3 at x=7 y=3
The number is calculted in column 3, using the values in row 7 and the 3x3 matrix number 7.
Column 3 contains the numbers 2, 6, 7 and 8. The missing values are 1,3,4,5 and 9. These values are stored in the array bb()
Row 7 contains the values 1, 4 and 5. The 3x3 matrix number 7 contains the value 9
The parameter cnt = 5.

Condition AUTO 4 vertical type 1 - special NRC Circle

 ```0 0 0|9 0 0|0 0 0 0 7 0|1 0 0|0 0 0 0 0 0|5 0 0|0 0 0 ----------------- 0 3 0|8 7 0|0 0 0 0 0 0|0 0 6|0 0 0 0 1 7|4 0 0|0 0 0 ----------------- 0 8 3|6 0 0|0 0 0 0 5 9|2 0 0|0 0 0 0 0 0|7 0 9|0 0 0 ```
The missing number is the value N=1 at x=2 y=4
The number is calculted in column 4, using the nrc 3x3 square #1
Column 4 contains the numbers are 2,4,5,6,7,8 and 9. The two missing numbers are 1 and 3. These 4 numbers are stored in the array bb()
The nrc 3x3 matrix contains the value 3. That means at position 2 in column 4 there cannot be the value 3.
That means at position 2 in column 4 there should be a 1.
The parameter cnt = 2.

Condition AUTO 5 vertical type 2

 ```0 0 0|0 0 0|0 0 5 0 0 0|0 0 0|0 0 9 0 0 0|0 0 0|0 0 2 ----------------- 0 6 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 6 0 0 0|6 0 9|0 0 0 ----------------- 0 0 0|0 0 0|0 0 1 0 0 0|0 0 0|0 0 3 0 0 0|0 0 0|0 0 4 ```
The missing number is the value N=6 at x=5 y=9
The number is calculted based on the values in column 9. This column contains the values 1,2,3,4,5 and 9. The numbers 6,7 and 8 are missing. These numbers are stored in the array bb()
Row 4 and row 6 contain the value 6. That means at position row 6 and column 9 there should be a value of 6.
The parameter cnt = 3

Condition AUTO 5 vertical type 2 - special circle

 ```3 0 0|0 0 0|0 0 0 6 0 0|0 0 0|0 0 0 5 0 0|0 0 0|0 0 0 ----------------- 4 0 0|0 0 0|0 0 0 1 0 0|0 0 0|0 0 7 0 0|0 0 0|0 0 0 ----------------- 0 1 3|0 0 0|0 0 0 9 6 5|0 0 0|0 0 0 0 0 7|0 0 0|0 0 0 ```
The missing number is the value N=1 at x=5 y=1
The number is calculted based on the values in column 1. This column contains the values 3,4,5,6,7 and 9. The numbers 1,2 and 8 are missing in the rows 5, 7 and 9. The missing numbers are stored in the array bb()
Row 7 contains the value 1. That means at column row 7 and row 9 there cannot be a 1 in column 1. This leaves the only row 5 column 1 open to have the value 1.
The parameter cnt = 3

Condition AUTO 6 horizontal

 ```0 0 0|9 1 3|0 0 0 0 0 0|7 2 4|0 0 0 0 0 0|0 0 0|1 0 7 ----------------- 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ----------------- 5 2 7|1 6 8|4 3 9 0 0 0|0 0 0|0 0 0 0 0 0|3 7 5|0 0 0 ```
The missing number is the value N=3 at x=7 y=8
The number is calculted based on the columns 4,5 and 6 and row 2.
The parameter cnt = 1

Condition AUTO 7 horizontal type 1

 ```0 0 0|0 0 0|0 5 0 0 0 0|7 2 0|0 0 0 4 0 2|0 0 0|0 9 0 ----------------- 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ----------------- 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 2 ```
The missing number is the value N=9 at x=3 y=8
The number is calculted based in row 3, based on the numbers in column 8.
Row 3 contains the numbers: 1,2,4,5,6,7 and 8. The two missing numbers are 3 and 9. These 2 numbers are stored in the array bb().
The coordinates (3,2) and (3,8) are stored in the arrays ixx() and iyy().
Column 8 already contains the number 3, that means the only value possible at the location (3,8) is the number 9.
The parameter cnt = 2

Condition AUTO 7 horizontal type 1

 ```0 0 0|0 0 0|0 0 0 0 0 2|0 0 0|0 0 0 0 0 3|0 0 0|0 0 0 ----------------- 0 0 7|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 8|0 0 0|0 0 0 ----------------- 0 3 5|6 0 9|4 1 0 0 0 0|0 0 0|0 0 0 0 2 0|0 8 0|0 0 0 ```
The missing number is the value 5 at x=7 y=4
The number is calculted in row 7 and based on the values in column 3.
Row 7 contains the values 1, 3, 4, 6 and 9. The 4 missing numbers are: 2, 5, 7 and 8. These 4 numbers are stored in the array bb().
Column 3 contains the 3 values: 2, 7 and 8, That means the position row 7, column 3 can only contain the value 5.
The parameter cnt = 4.

Condition AUTO 7 horizontal type 1 - Special circle

 ```0 0 0|0 0 0|0 0 0 0 0 2|0 0 0|0 0 0 0 0 3|0 0 0|0 0 0 ----------------- 0 0 7|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 8|0 0 0|0 0 0 ----------------- 7 3 5|6 0 9|4 1 8 0 0 0|0 0 0|0 0 0 0 2 0|0 8 0|0 0 0 ```
The missing number is the value 7 at x=7 y=1
The number is calculted in row 7 and based on the values in the 3x3 matrix number 7.
Row 7 contains the values 1, 3, 4, 5, 6, 8 and 9. The 4 missing numbers are: 2 and 7. These 2 numbers are stored in the array bb().
The 3x3 matrix number 7 contains the value 2. That means at row 7, position 1 there can not be the value 2. The only value left over is the 7.
The parameter cnt = 2.

Condition AUTO 8 horizontal type 2

 ```0 0 0|0 0 0|2 5 0 0 2 0|3 0 1|0 0 0 0 0 0|0 0 2|0 0 0 ----------------- 0 0 0|0 0 0|0 0 0 5 0 3|2 1 0|9 6 8 0 0 0|0 0 0|0 0 0 ----------------- 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ```
The missing number is the value 2 at location x=5 y=4
The number is calculted in the row 4 which has three empty locations
The location is calculted based on the columns 2 and 6.
The parameter cnt =

Condition AUTO 8 horizontal type 2 - Special circle

 ```0 0 0|0 0 0|0 5 0 0 2 0|3 0 1|0 0 0 0 0 0|0 0 2|0 0 0 ----------------- 0 0 0|0 0 0|0 0 0 5 0 3|0 0 0|9 6 6 0 0 0|0 0 0|0 0 0 ----------------- 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ```
The missing number is the value 6 at location x=5 y=9
The number is calculted in the row 4 which has three empty locations
The location is calculted based on the columns 2 and 6.
The parameter cnt =

Condition AUTO 9 Circle

 ```0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ----------------- 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ----------------- 4 6 3|0 0 0|1 7 5 2 5 7|0 0 0|0 0 0 9 1 8|5 0 0|4 0 0 ```
The missing number is the value 7 at x=8 y=3
The number is calculted in the 3x3 square #7
The known numbers are 1,2,3,4,5,6,8 and 9. The missing number is 7.
The parameter cnt =

Condition AUTO 10 Circle

 ```0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ----------------- 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ----------------- 4 6 3|0 0 0|1 7 5 2 5 0|0 0 0|0 0 0 9 1 8|5 0 0|4 0 0 ```
The missing number is the value 3 at x=7 y=3
The number is calculted in the 3x3 square #7
The known numbers are 1,2,4,5,6,8 and 9. The missing numbers are 3 and 7.
In row 8 there is a number 3. That means the missing number is in row 7.
The parameter cnt =

Condition AUTO 11 - NRC Circle 1

 ```0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ----------------- 0 0 0|8 7 0|0 0 0 0 0 0|0 0 6|0 0 0 0 1 7|4 0 0|0 0 0 ----------------- 0 8 3|6 0 0|0 0 0 0 5 9|2 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ```
The missing number is the value 4 at x=6 y=4
The number is calculted in the nrc 3x3 square #3
The known numbers are 1,2,3,5,6,7,8 and 9. The only missing number is a 4 in column 4. The array bb() is not used.
The parameter cnt = 1

Condition AUTO 12 - NRC Circle 2

 ```0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ----------------- 0 0 0|8 7 0|0 0 0 0 0 0|0 0 6|0 0 0 0 1 7|0 0 0|0 0 0 ----------------- 0 8 3|6 0 0|0 0 0 0 5 9|2 0 0|0 0 0 0 0 0|0 0 0|0 0 0 ```
The missing number is the value 6 at x=7 y=4
The number is calculted in the nrc 3x3 square #3
The known numbers are 1,2,3,5,7,8 and 9. The missing numbers are 4 and 6 in column 4. These 2 numbers are stored in the array bb().
In the 3x3 matrix #5 there is a number 6. That means at position 6 in column 4 there cannot be a 6.
That means only at position 7 in column 4 there can be a 6.
The parameter cnt = 2.

Feedback

None

Original 2 July 2016