Jump to content

Fast Sudoku solver (insane) in pure SQL[ite]


jchd
 Share

Recommended Posts

16 hours ago, farouk12 said:

that sad because its take less then 5 sec with backtracking algorithm built in autoit

well, it takes forever ( 307 sec. ) to solve "Hardest" from the OP =/

PS: tweaked your code to speed up the process ( you had too many GUI updates )

Spoiler

 

tho, it would be nice to integrate the @jchd sqlite way to your GUI :)  

PS2: below is the results of the sqlite output ( and the code )

Spoiler
Easy problem
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃5│3│.┃.│7│.┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃6│.│.┃1│9│5┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│9│8┃.│.│.┃.│6│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃8│.│.┃.│6│.┃.│.│3┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃4│.│.┃8│.│3┃.│.│1┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃7│.│.┃.│2│.┃.│.│6┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃.│6│.┃.│.│.┃2│8│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃4│1│9┃.│.│5┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃.│8│.┃.│7│9┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛

Easy solution
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃5│3│4┃6│7│8┃9│1│2┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃6│7│2┃1│9│5┃3│4│8┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃1│9│8┃3│4│2┃5│6│7┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃8│5│9┃7│6│1┃4│2│3┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃4│2│6┃8│5│3┃7│9│1┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃7│1│3┃9│2│4┃8│5│6┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃9│6│1┃5│3│7┃2│8│4┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃2│8│7┃4│1│9┃6│3│5┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃3│4│5┃2│8│6┃1│7│9┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛
0.006 sec. to solve

Sqlite problem
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃1│.│.┃.│.│7┃.│9│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│3│.┃.│2│.┃.│.│8┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│9┃6│.│.┃5│.│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃.│.│5┃3│.│.┃9│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│1│.┃.│8│.┃.│.│2┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃6│.│.┃.│.│4┃.│.│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃3│.│.┃.│.│.┃.│1│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│4│.┃.│.│.┃.│.│7┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│7┃.│.│.┃3│.│.┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛

Sqlite solution
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃1│6│2┃8│5│7┃4│9│3┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃5│3│4┃1│2│9┃6│7│8┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃7│8│9┃6│4│3┃5│2│1┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃4│7│5┃3│1│2┃9│8│6┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃9│1│3┃5│8│6┃7│4│2┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃6│2│8┃7│9│4┃1│3│5┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃3│5│6┃4│7│8┃2│1│9┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃2│4│1┃9│3│5┃8│6│7┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃8│9│7┃2│6│1┃3│5│4┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛
0.025 sec. to solve

Hard problem
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃.│.│.┃.│.│6┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│5│9┃.│.│.┃.│.│8┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃2│.│.┃.│.│8┃.│.│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃.│4│5┃.│.│.┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│3┃.│.│.┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│6┃.│.│3┃.│5│4┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃.│.│.┃3│2│5┃.│.│6┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃.│.│.┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃.│.│.┃.│.│.┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛

Hard solution
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃3│7│8┃2│4│6┃9│1│5┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃6│5│9┃7│3│1┃4│2│8┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃2│1│4┃5│9│8┃6│7│3┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃1│4│5┃9│6│2┃3│8│7┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃8│2│3┃4│5│7┃1│6│9┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃7│9│6┃1│8│3┃2│5│4┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃4│8│1┃3│2│5┃7│9│6┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃5│3│2┃6│7│9┃8│4│1┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃9│6│7┃8│1│4┃5│3│2┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛
0.008 sec. to solve

Hola problem
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃4│.│2┃.│.│.┃.│3│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃1│.│.┃6│.│5┃.│2│9┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃9│.│.┃.│.│.┃1│.│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃.│.│.┃.│4│2┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│8│.┃9│.│1┃.│5│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃8│5│.┃.│.│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃.│.│3┃.│.│.┃.│.│8┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃6│1│.┃5│.│4┃.│.│2┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│4│.┃.│.│.┃5│.│7┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛

Hola solution
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃4│6│2┃1│9│8┃7│3│5┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃1│3│8┃6│7│5┃4│2│9┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃9│7│5┃4│2│3┃1│8│6┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃5│9│6┃3│4│2┃8│7│1┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃7│8│4┃9│6│1┃2│5│3┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃3│2│1┃8│5│7┃9│6│4┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃2│5│3┃7│1│9┃6│4│8┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃6│1│7┃5│8│4┃3│9│2┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃8│4│9┃2│3│6┃5│1│7┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛
0.008 sec. to solve

Hardest problem
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃8│.│.┃.│.│.┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│3┃6│.│.┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│7│.┃.│9│.┃2│.│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃.│5│.┃.│.│7┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃.│4│5┃7│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃1│.│.┃.│3│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃.│.│1┃.│.│.┃.│6│8┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│8┃5│.│.┃.│1│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│9│.┃.│.│.┃4│.│.┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛

Hardest solution
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃8│1│2┃7│5│3┃6│4│9┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃9│4│3┃6│8│2┃1│7│5┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃6│7│5┃4│9│1┃2│8│3┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃1│5│4┃2│3│7┃8│9│6┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃3│6│9┃8│4│5┃7│2│1┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃2│8│7┃1│6│9┃5│3│4┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃5│2│1┃9│7│4┃3│6│8┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃4│3│8┃5│2│6┃9│1│7┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃7│9│6┃3│1│8┃4│5│2┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛
0.595 sec. to solve

EasterMonster problem
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃1│.│.┃.│.│.┃.│.│2┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│9│.┃4│.│.┃.│5│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│6┃.│.│.┃7│.│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃.│5│.┃9│.│3┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃.│7│.┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃8│5│.┃.│4│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃7│.│.┃.│.│.┃6│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│3│.┃.│.│9┃.│8│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│2┃.│.│.┃.│.│1┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛

EasterMonster solution
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃1│7│4┃3│8│5┃9│6│2┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃2│9│3┃4│6│7┃1│5│8┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃5│8│6┃1│9│2┃7│3│4┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃4│5│1┃9│2│3┃8│7│6┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃9│2│8┃6│7│4┃3│1│5┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃3│6│7┃8│5│1┃2│4│9┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃7│1│9┃5│4│8┃6│2│3┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃6│3│5┃2│1│9┃4│8│7┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃8│4│2┃7│3│6┃5│9│1┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛
0.007 sec. to solve

Post #16      problem
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃.│6│1┃.│.│7┃.│.│3┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│9│2┃.│.│3┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃.│.│.┃.│.│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃.│.│8┃5│3│.┃.│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃.│.│.┃5│.│4┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃5│.│.┃.│.│8┃.│.│.┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃.│4│.┃.│.│.┃.│.│1┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃.│.│.┃1│6│.┃8│.│.┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃6│.│.┃.│.│.┃.│.│.┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛

Post #16      solution
┏━┯━┯━┳━┯━┯━┳━┯━┯━┓
┃4│6│1┃9│8│7┃2│5│3┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃7│9│2┃4│5│3┃1│6│8┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃3│8│5┃2│1│6┃4│7│9┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃1│2│8┃5│3│4┃7│9│6┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃9│3│6┃7│2│1┃5│8│4┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃5│7│4┃6│9│8┃3│1│2┃
┣━┿━┿━╋━┿━┿━╋━┿━┿━┫
┃8│4│9┃3│7│5┃6│2│1┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃2│5│3┃1│6│9┃8│4│7┃
┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨
┃6│1│7┃8│4│2┃9│3│5┃
┗━┷━┷━┻━┷━┷━┻━┷━┷━┛
17.278 sec. to solve

 

Spoiler
;;; https://www.autoitscript.com/forum/topic/168208-fast-sudoku-solver-insane-in-pure-sqlite/
#include <SQLite.au3>
;~ #include <SQLite.dll.au3>    ; download the most recent suitable DLL once and comment this out

Local $hDB

Local $aSudokus[7][2] = [ _
    ["Easy",          "53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79"], _
    ["Sqlite",        "1....7.9..3..2...8..96..5....53..9...1..8...26....4...3......1..4......7..7...3.."], _
    ["Hard",          ".....6....59.....82....8....45........3........6..3.54...325..6.................."], _
    ["Hola",          "4.2....3.1..6.5.299.....1......42....8.9.1.5....85......3.....861.5.4..2.4....5.7"], _
    ["Hardest",       "8..........36......7..9.2...5...7.......457.....1...3...1....68..85...1..9....4.."], _
    ["EasterMonster", "1.......2.9.4...5...6...7...5.9.3.......7.......85..4.7.....6...3...9.8...2.....1"], _
    ["Post #16     ", ".61..7..3.92..3..............853..........5.45....8....4......1...16.8..6........"]]

If Not _SQLite_Startup() Then Exit 2
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)

$hDB = _SQLite_Open()

If Not $hDB Then Exit 3

Local $sTempCreate = "" & _
"create temporary table i (" & _
    "i integer primary key, " & _
    "name char, " & _
    "word0, " & _
    "word1, " & _
    "peers0, " & _
    "peers1)" & _
";" & _
"insert into i " & _
    "select i, " & _
        "char(65+y)||(x+1) as name, " & _
        "case when iword=0 then 1<<ibit else 0 end AS word0, " & _
        "case when iword=1 then 1<<ibit else 0 end AS word1, " & _
        "CASE WHEN iword=0 THEN (512-1)<<(y*9) ELSE 0 END | " & _
            "((1+512*(1+512*(1+512*(1+512*(1+512)))))<<x) | " & _
            "CASE WHEN iword=0 THEN ((8-1)*(1+512*(1+512)))<<(y/3*3*9+x/3*3) ELSE 0 END AS peers0, " & _
        "CASE WHEN iword=1 THEN (512-1)<<((y%6)*9) ELSE 0 END | " & _
            "((1 + 512 * (1 + 512)) << x) | " & _
            "CASE WHEN iword=1 THEN ((8-1)*(1+512*(1+512)))<<((y%6)/3*3*9+x/3*3) ELSE 0 END AS peers1 " & _
    "from (" & _
        "with xy AS (SELECT 0 AS xy UNION ALL SELECT xy+1 FROM xy WHERE xy < 80) " & _
        "select  xy+1 AS i, " & _
                "xy%9 AS x, " & _
                "xy/9 AS y, " & _
                "xy/54 AS iword, " & _
                "xy%54 AS ibit " & _
        "from xy" & _
    ")" & _
";"

If $SQLITE_OK <> _SQLite_Exec($hDB, $sTempCreate) Then
    ConsoleWrite(@LF & "! your version of sqlite.dll is too old !" & @LF & @LF)
    Exit 4
EndIf


Local $sInsaneSolver = "" & _
"with   z AS (SELECT 1 AS z UNION ALL SELECT z+1 FROM z WHERE z < 9), " & _
        "input as (" & _
            "select  input, " & _
                    "sud, " & _
                    "ifnull (sum (word0), 0) as w0, " & _
                    "ifnull (sum (word1), 0) as w1, " & _
                    "ifnull (sum (case when z=1 then word0 end), 0) as w10, " & _
                    "ifnull (sum (case when z=1 then word1 end), 0) as w11, " & _
                    "ifnull (sum (case when z=2 then word0 end), 0) as w20, " & _
                    "ifnull (sum (case when z=2 then word1 end), 0) as w21, " & _
                    "ifnull (sum (case when z=3 then word0 end), 0) as w30, " & _
                    "ifnull (sum (case when z=3 then word1 end), 0) as w31, " & _
                    "ifnull (sum (case when z=4 then word0 end), 0) as w40, " & _
                    "ifnull (sum (case when z=4 then word1 end), 0) as w41, " & _
                    "ifnull (sum (case when z=5 then word0 end), 0) as w50, " & _
                    "ifnull (sum (case when z=5 then word1 end), 0) as w51, " & _
                    "ifnull (sum (case when z=6 then word0 end), 0) as w60, " & _
                    "ifnull (sum (case when z=6 then word1 end), 0) as w61, " & _
                    "ifnull (sum (case when z=7 then word0 end), 0) as w70, " & _
                    "ifnull (sum (case when z=7 then word1 end), 0) as w71, " & _
                    "ifnull (sum (case when z=8 then word0 end), 0) as w80, " & _
                    "ifnull (sum (case when z=8 then word1 end), 0) as w81, " & _
                    "ifnull (sum (case when z=9 then word0 end), 0) as w90, " & _
                    "ifnull (sum (case when z=9 then word1 end), 0) as w91, " & _
                    "count (*) as fixed, " & _
                    "ifnull (sum (z=1), 0) as f1, " & _
                    "ifnull (sum (z=2), 0) as f2, " & _
                    "ifnull (sum (z=3), 0) as f3, " & _
                    "ifnull (sum (z=4), 0) as f4, " & _
                    "ifnull (sum (z=5), 0) as f5, " & _
                    "ifnull (sum (z=6), 0) as f6, " & _
                    "ifnull (sum (z=7), 0) as f7, " & _
                    "ifnull (sum (z=8), 0) as f8, " & _
                    "ifnull (sum (z=9), 0) as f9 " & _
            "from ( " & _
                "select '" & $aSudokus[0][0] & "' as input, " & _
                "'" & $aSudokus[0][1] & "' as sud " & _
            "union all " & _
                "select '" & $aSudokus[1][0] & "', " & _
                "'" & $aSudokus[1][1] & "' " & _
            "union all " & _
                "select '" & $aSudokus[2][0] & "', " & _
                "'" & $aSudokus[2][1] & "' " & _
            "union all " & _
                "select '" & $aSudokus[3][0] & "', " & _
                "'" & $aSudokus[3][1] & "' " & _
            "union all " & _
                "select '" & $aSudokus[4][0] & "', " & _
                "'" & $aSudokus[4][1] & "' " & _
            "union all " & _
                "select '" & $aSudokus[5][0] & "', " & _
                "'" & $aSudokus[5][1] & "' " & _
            "union all " & _
                "select '" & $aSudokus[6][0] & "', " & _
                "'" & $aSudokus[6][1] & "' " & _
            ") " & _
            "join i " & _
            "join z on z = cast (substr (sud, i.i, 1) as int) " & _
            "where input='#####' " & _
        ") " & _
", " & _
"sudoku as (" & _
    "select " & _
        "'' as text, " & _
        "fixed, " & _
        "f1,f2,f3,f4,f5,f6,f7,f8,f9, " & _
        "0 as zfixed, " & _
        "0 as i0, " & _
        "w0, w1, " & _
        "w10, w11, " & _
        "w20, w21, " & _
        "w30, w31, " & _
        "w40, w41, " & _
        "w50, w51, " & _
        "w60, w61, " & _
        "w70, w71, " & _
        "w80, w81, " & _
        "w90, w91 " & _
    "from input " & _
    "union all " & _
    "select " & _
        "(fixed+1)||','|| " & _
            "name||','|| " & _
            "( " & _
                "(w10&peers0 or w11&peers1) + " & _
                "(w20&peers0 or w21&peers1) + " & _
                "(w30&peers0 or w31&peers1) + " & _
                "(w40&peers0 or w41&peers1) + " & _
                "(w50&peers0 or w51&peers1) + " & _
                "(w60&peers0 or w61&peers1) + " & _
                "(w70&peers0 or w71&peers1) + " & _
                "(w80&peers0 or w81&peers1) + " & _
                "(w90&peers0 or w91&peers1) " & _
            ") ||','|| " & _
            "z||','|| " & _
            "'', " & _
        "fixed+1, " & _
        "f1+(z=1), " & _
        "f2+(z=2), " & _
        "f3+(z=3), " & _
        "f4+(z=4), " & _
        "f5+(z=5), " & _
        "f6+(z=6), " & _
        "f7+(z=7), " & _
        "f8+(z=8), " & _
        "f9+(z=9), " & _
        "case z " & _
            "when 1 then f1 " & _
            "when 2 then f2 " & _
            "when 3 then f3 " & _
            "when 4 then f4 " & _
            "when 5 then f5 " & _
            "when 6 then f6 " & _
            "when 7 then f7 " & _
            "when 8 then f8 " & _
            "when 9 then f9 " & _
        "end, " & _
        "i.i, " & _
        "w0+word0, " & _
        "w1+word1, " & _
        "case when z=1 then w10+word0 else w10 end, " & _
        "case when z=1 then w11+word1 else w11 end, " & _
        "case when z=2 then w20+word0 else w20 end, " & _
        "case when z=2 then w21+word1 else w21 end, " & _
        "case when z=3 then w30+word0 else w30 end, " & _
        "case when z=3 then w31+word1 else w31 end, " & _
        "case when z=4 then w40+word0 else w40 end, " & _
        "case when z=4 then w41+word1 else w41 end, " & _
        "case when z=5 then w50+word0 else w50 end, " & _
        "case when z=5 then w51+word1 else w51 end, " & _
        "case when z=6 then w60+word0 else w60 end, " & _
        "case when z=6 then w61+word1 else w61 end, " & _
        "case when z=7 then w70+word0 else w70 end, " & _
        "case when z=7 then w71+word1 else w71 end, " & _
        "case when z=8 then w80+word0 else w80 end, " & _
        "case when z=8 then w81+word1 else w81 end, " & _
        "case when z=9 then w90+word0 else w90 end, " & _
        "case when z=9 then w91+word1 else w91 end " & _
    "from sudoku " & _
    "join i " & _
        "on i = ifnull ( " & _
                            "( " & _
                                "select  i " & _
                                "from    i " & _
                                "where   i > i0 " & _
                                    "and     not (word0&w0 or word1&w1) " & _
                                    "and     ( " & _
                                                "(w10&peers0 or w11&peers1) + " & _
                                                "(w20&peers0 or w21&peers1) + " & _
                                                "(w30&peers0 or w31&peers1) + " & _
                                                "(w40&peers0 or w41&peers1) + " & _
                                                "(w50&peers0 or w51&peers1) + " & _
                                                "(w60&peers0 or w61&peers1) + " & _
                                                "(w70&peers0 or w71&peers1) + " & _
                                                "(w80&peers0 or w81&peers1) + " & _
                                                "(w90&peers0 or w91&peers1) " & _
                                            ") = 8 " & _
                                "limit 1 " & _
                            ") " & _
                            ", " & _
                            "( " & _
                                "select  i " & _
                                "from    ( " & _
                                    "select  i, " & _
                                            "max ( " & _
                                                    "(w10&peers0 or w11&peers1) + " & _
                                                    "(w20&peers0 or w21&peers1) + " & _
                                                    "(w30&peers0 or w31&peers1) + " & _
                                                    "(w40&peers0 or w41&peers1) + " & _
                                                    "(w50&peers0 or w51&peers1) + " & _
                                                    "(w60&peers0 or w61&peers1) + " & _
                                                    "(w70&peers0 or w71&peers1) + " & _
                                                    "(w80&peers0 or w81&peers1) + " & _
                                                    "(w90&peers0 or w91&peers1) " & _
                                            ") as maxfixed " & _
                                    "from    i " & _
                                    "where   not (word0&w0 or word1&w1) " & _
                                ") " & _
                                "where     maxfixed is not null " & _
                        ")) " & _
    "join    z " & _
    "on " & _
        "case z " & _
            "when 1 then not (w10&peers0 or w11&peers1) " & _
            "when 2 then not (w20&peers0 or w21&peers1) " & _
            "when 3 then not (w30&peers0 or w31&peers1) " & _
            "when 4 then not (w40&peers0 or w41&peers1) " & _
            "when 5 then not (w50&peers0 or w51&peers1) " & _
            "when 6 then not (w60&peers0 or w61&peers1) " & _
            "when 7 then not (w70&peers0 or w71&peers1) " & _
            "when 8 then not (w80&peers0 or w81&peers1) " & _
            "when 9 then not (w90&peers0 or w91&peers1) " & _
        "end " & _
    "order by fixed desc, " & _
            "zfixed desc " & _
") " & _
", " & _
"output as ( " & _
    "select  * " & _
    "from    ( " & _
        "select  1 as i, " & _
                "w10, w11, " & _
                "w20, w21, " & _
                "w30, w31, " & _
                "w40, w41, " & _
                "w50, w51, " & _
                "w60, w61, " & _
                "w70, w71, " & _
                "w80, w81, " & _
                "w90, w91, " & _
                "'' as sud " & _
        "from    sudoku " & _
        "where   fixed = 81 limit 1 " & _
    ") " & _
    "union all " & _
    "select  nullif (output.i + 1, 82), " & _
            "w10, w11, " & _
            "w20, w21, " & _
            "w30, w31, " & _
            "w40, w41, " & _
            "w50, w51, " & _
            "w60, w61, " & _
            "w70, w71, " & _
            "w80, w81, " & _
            "w90, w91, " & _
            "sud || replace (cast ( " & _
                "case 1 " & _
                "when w10&word0 OR w11&word1 then 1 " & _
                "when w20&word0 OR w21&word1 then 2 " & _
                "when w30&word0 OR w31&word1 then 3 " & _
                "when w40&word0 OR w41&word1 then 4 " & _
                "when w50&word0 OR w51&word1 then 5 " & _
                "when w60&word0 OR w61&word1 then 6 " & _
                "when w70&word0 OR w71&word1 then 7 " & _
                "when w80&word0 OR w81&word1 then 8 " & _
                "when w90&word0 OR w91&word1 then 9 " & _
                "else 0 " & _
                "end " & _
                "as char), '0', '.') " & _
    "from    output " & _
    "join    i on i.i = output.i " & _
") " & _
", " & _
"result as (select sud s from input union all select sud from output WHERE i is null) " & _
"SELECT " & _
       "'┏━┯━┯━┳━┯━┯━┳━┯━┯━┓' || x'0d0a' || " & _
       "'┃' || substr(s, 1,1) || '│' || substr(s, 2,1) || '│' || substr(s, 3,1) || '┃' || " & _
              "substr(s, 4,1) || '│' || substr(s, 5,1) || '│' || substr(s, 6,1) || '┃' || " & _
              "substr(s, 7,1) || '│' || substr(s, 8,1) || '│' || substr(s, 9,1) || '┃' || x'0d0a' || " & _
       "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
       "'┃' || substr(s,10,1) || '│' || substr(s,11,1) || '│' || substr(s,12,1) || '┃' || " & _
              "substr(s,13,1) || '│' || substr(s,14,1) || '│' || substr(s,15,1) || '┃' || " & _
              "substr(s,16,1) || '│' || substr(s,17,1) || '│' || substr(s,18,1) || '┃' || x'0d0a' || " & _
       "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
       "'┃' || substr(s,19,1) || '│' || substr(s,20,1) || '│' || substr(s,21,1) || '┃' || " & _
              "substr(s,22,1) || '│' || substr(s,23,1) || '│' || substr(s,24,1) || '┃' || " & _
              "substr(s,25,1) || '│' || substr(s,26,1) || '│' || substr(s,27,1) || '┃' || x'0d0a' || " & _
       "'┣━┿━┿━╋━┿━┿━╋━┿━┿━┫' || x'0d0a' || " & _
       "'┃' || substr(s,28,1) || '│' || substr(s,29,1) || '│' || substr(s,30,1) || '┃' || " & _
              "substr(s,31,1) || '│' || substr(s,32,1) || '│' || substr(s,33,1) || '┃' || " & _
              "substr(s,34,1) || '│' || substr(s,35,1) || '│' || substr(s,36,1) || '┃' || x'0d0a' || " & _
       "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
       "'┃' || substr(s,37,1) || '│' || substr(s,38,1) || '│' || substr(s,39,1) || '┃' || " & _
              "substr(s,40,1) || '│' || substr(s,41,1) || '│' || substr(s,42,1) || '┃' || " & _
              "substr(s,43,1) || '│' || substr(s,44,1) || '│' || substr(s,45,1) || '┃' || x'0d0a' || " & _
       "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
       "'┃' || substr(s,46,1) || '│' || substr(s,47,1) || '│' || substr(s,48,1) || '┃' || " & _
              "substr(s,49,1) || '│' || substr(s,50,1) || '│' || substr(s,51,1) || '┃' || " & _
              "substr(s,52,1) || '│' || substr(s,53,1) || '│' || substr(s,54,1) || '┃' || x'0d0a' || " & _
       "'┣━┿━┿━╋━┿━┿━╋━┿━┿━┫' || x'0d0a' || " & _
       "'┃' || substr(s,55,1) || '│' || substr(s,56,1) || '│' || substr(s,57,1) || '┃' || " & _
              "substr(s,58,1) || '│' || substr(s,59,1) || '│' || substr(s,60,1) || '┃' || " & _
              "substr(s,61,1) || '│' || substr(s,62,1) || '│' || substr(s,63,1) || '┃' || x'0d0a' || " & _
       "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
       "'┃' || substr(s,64,1) || '│' || substr(s,65,1) || '│' || substr(s,66,1) || '┃' || " & _
              "substr(s,67,1) || '│' || substr(s,68,1) || '│' || substr(s,69,1) || '┃' || " & _
              "substr(s,70,1) || '│' || substr(s,71,1) || '│' || substr(s,72,1) || '┃' || x'0d0a' || " & _
       "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
       "'┃' || substr(s,73,1) || '│' || substr(s,74,1) || '│' || substr(s,75,1) || '┃' || " & _
              "substr(s,76,1) || '│' || substr(s,77,1) || '│' || substr(s,78,1) || '┃' || " & _
              "substr(s,79,1) || '│' || substr(s,80,1) || '│' || substr(s,81,1) || '┃' || x'0d0a' || " & _
       "'┗━┷━┷━┻━┷━┷━┻━┷━┷━┛'" & _
"FROM result;"

Local $aRows, $iRows, $iCols
Local $sProblem, $tTimer = TimerInit(), $sAll = ""

For $n = 0 To UBound($aSudokus) - 1
    $tTimer = TimerInit()
    $sProblem = StringReplace($sInsaneSolver, "#####", $aSudokus[$n][0])
    _SQLite_GetTable($hDB, $sProblem, $aRows,$iRows, $iCols)
    _ConsoleWrite($aSudokus[$n][0] & " problem" & @CRLF & $aRows[2] & @CRLF & @CRLF)
    _ConsoleWrite($aSudokus[$n][0] & " solution" & @CRLF & $aRows[3] & @CRLF & Round(TimerDiff($tTimer) / 1000 , 3) & " sec. to solve" & @CRLF & @CRLF)
Next
ClipPut($sAll) ; to paste on notepad

Func _ConsoleWrite($s)
    $sAll &= $s
    ConsoleWrite(BinaryToString(StringToBinary($s, 4), 1))
EndFunc

 

 

Edited by argumentum
show the code, v2

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

2 hours ago, argumentum said:

well, it takes forever ( 307 sec. ) to solve "Hardest" from the OP =/

PS: tweaked your code to speed up the process ( you had too many GUI updates )

tho, it would be nice to integrate the @jchd sqlite way to your GUI :)  

Well its not mine i got it from topic here (I dont know the link / Author).

 

And thanks for the edit, now its good as example.

I found out that back tracking is more effective in some situations, rather than the sql way.(Big deference)

Edited by farouk12
Link to comment
Share on other sites

and since I can not let go of my obsessive nature, here is a broader comparison of the two systems, from an AutoIt execution time viewpoint :
Edzard Pasma's

From TOP 95: # 1 took 0.022 sec. to solve
From TOP 95: # 2 took 0.061 sec. to solve
From TOP 95: # 3 took 0.054 sec. to solve
From TOP 95: # 4 took 2.86 sec. to solve
From TOP 95: # 5 took 1.936 sec. to solve
From TOP 95: # 6 took 8.716 sec. to solve
From TOP 95: # 7 took 2.705 sec. to solve
From TOP 95: # 8 took 0.72 sec. to solve
From TOP 95: # 9 took 2.106 sec. to solve
From TOP 95: # 10 took 4.136 sec. to solve
From TOP 95: # 11 took 0.547 sec. to solve
From TOP 95: # 12 took 0.123 sec. to solve
From TOP 95: # 13 took 0.166 sec. to solve
From TOP 95: # 14 took 1.009 sec. to solve
From TOP 95: # 15 took 0.161 sec. to solve
From TOP 95: # 16 took 0.536 sec. to solve
From TOP 95: # 17 took 0.038 sec. to solve
From TOP 95: # 18 took 1.947 sec. to solve
From TOP 95: # 19 took 0.031 sec. to solve
From TOP 95: # 20 took 0.017 sec. to solve
From TOP 95: # 21 took 4.631 sec. to solve
From TOP 95: # 22 took 0.048 sec. to solve
From TOP 95: # 23 took 0.09 sec. to solve
From TOP 95: # 24 took 0.099 sec. to solve
From TOP 95: # 25 took 0.142 sec. to solve
From TOP 95: # 26 took 0.287 sec. to solve
From TOP 95: # 27 took 0.217 sec. to solve
From TOP 95: # 28 took 5.642 sec. to solve
From TOP 95: # 29 took 0.03 sec. to solve
From TOP 95: # 30 took 0.202 sec. to solve
From TOP 95: # 31 took 0.044 sec. to solve
From TOP 95: # 32 took 0.021 sec. to solve
From TOP 95: # 33 took 0.013 sec. to solve
From TOP 95: # 34 took 3.036 sec. to solve
From TOP 95: # 35 took 0.266 sec. to solve
From TOP 95: # 36 took 0.061 sec. to solve
From TOP 95: # 37 took 0.113 sec. to solve
From TOP 95: # 38 took 0.01 sec. to solve
From TOP 95: # 39 took 0.352 sec. to solve
From TOP 95: # 40 took 0.027 sec. to solve
From TOP 95: # 41 took 4.337 sec. to solve
From TOP 95: # 42 took 0.42 sec. to solve
From TOP 95: # 43 took 0.222 sec. to solve
From TOP 95: # 44 took 0.099 sec. to solve
From TOP 95: # 45 took 0.073 sec. to solve
From TOP 95: # 46 took 3.182 sec. to solve
From TOP 95: # 47 took 0.217 sec. to solve
From TOP 95: # 48 took 0.059 sec. to solve
From TOP 95: # 49 took 0.221 sec. to solve
From TOP 95: # 50 took 0.422 sec. to solve
From TOP 95: # 51 took 0.014 sec. to solve
From TOP 95: # 52 took 0.104 sec. to solve
From TOP 95: # 53 took 0.095 sec. to solve
From TOP 95: # 54 took 0.013 sec. to solve
From TOP 95: # 55 took 0.061 sec. to solve
From TOP 95: # 56 took 0.021 sec. to solve
From TOP 95: # 57 took 0.315 sec. to solve
From TOP 95: # 58 took 0.063 sec. to solve
From TOP 95: # 59 took 0.051 sec. to solve
From TOP 95: # 60 took 0.013 sec. to solve
From TOP 95: # 61 took 0.187 sec. to solve
From TOP 95: # 62 took 0.07 sec. to solve
From TOP 95: # 63 took 0.056 sec. to solve
From TOP 95: # 64 took 0.252 sec. to solve
From TOP 95: # 65 took 0.006 sec. to solve
From TOP 95: # 66 took 0.222 sec. to solve
From TOP 95: # 67 took 0.193 sec. to solve
From TOP 95: # 68 took 0.164 sec. to solve
From TOP 95: # 69 took 0.056 sec. to solve
From TOP 95: # 70 took 0.069 sec. to solve
From TOP 95: # 71 took 2.819 sec. to solve
From TOP 95: # 72 took 0.024 sec. to solve
From TOP 95: # 73 took 0.044 sec. to solve
From TOP 95: # 74 took 0.174 sec. to solve
From TOP 95: # 75 took 0.043 sec. to solve
From TOP 95: # 76 took 0.242 sec. to solve
From TOP 95: # 77 took 0.079 sec. to solve
From TOP 95: # 78 took 0.036 sec. to solve
From TOP 95: # 79 took 0.25 sec. to solve
From TOP 95: # 80 took 0.027 sec. to solve
From TOP 95: # 81 took 0.086 sec. to solve
From TOP 95: # 82 took 0.04 sec. to solve
From TOP 95: # 83 took 0.201 sec. to solve
From TOP 95: # 84 took 0.054 sec. to solve
From TOP 95: # 85 took 0.015 sec. to solve
From TOP 95: # 86 took 0.021 sec. to solve
From TOP 95: # 87 took 0.11 sec. to solve
From TOP 95: # 88 took 0.009 sec. to solve
From TOP 95: # 89 took 0.135 sec. to solve
From TOP 95: # 90 took 0.077 sec. to solve
From TOP 95: # 91 took 0.02 sec. to solve
From TOP 95: # 92 took 0.011 sec. to solve
From TOP 95: # 93 took 0.035 sec. to solve
From TOP 95: # 94 took 0.015 sec. to solve
From TOP 95: # 95 took 0.189 sec. to solve
Spoiler
;;; https://www.autoitscript.com/forum/topic/168208-fast-sudoku-solver-insane-in-pure-sqlite/
#include <SQLite.au3>
;~ #include <SQLite.dll.au3>    ; download the most recent suitable DLL once and comment this out

Local $hDB

Local $aSudokus[7][2] = [ _
        ["Easy", "53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79"], _
        ["Sqlite", "1....7.9..3..2...8..96..5....53..9...1..8...26....4...3......1..4......7..7...3.."], _
        ["Hard", ".....6....59.....82....8....45........3........6..3.54...325..6.................."], _
        ["Hola", "4.2....3.1..6.5.299.....1......42....8.9.1.5....85......3.....861.5.4..2.4....5.7"], _
        ["Hardest", "8..........36......7..9.2...5...7.......457.....1...3...1....68..85...1..9....4.."], _
        ["EasterMonster", "1.......2.9.4...5...6...7...5.9.3.......7.......85..4.7.....6...3...9.8...2.....1"], _
        ["Post #16     ", ".61..7..3.92..3..............853..........5.45....8....4......1...16.8..6........"]]

GenArray() ; do away with the original array and replace with this sample

If Not _SQLite_Startup() Then Exit 2
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)

$hDB = _SQLite_Open()

If Not $hDB Then Exit 3

Local $sTempCreate = "" & _
        "create temporary table i (" & _
        "i integer primary key, " & _
        "name char, " & _
        "word0, " & _
        "word1, " & _
        "peers0, " & _
        "peers1)" & _
        ";" & _
        "insert into i " & _
        "select i, " & _
        "char(65+y)||(x+1) as name, " & _
        "case when iword=0 then 1<<ibit else 0 end AS word0, " & _
        "case when iword=1 then 1<<ibit else 0 end AS word1, " & _
        "CASE WHEN iword=0 THEN (512-1)<<(y*9) ELSE 0 END | " & _
        "((1+512*(1+512*(1+512*(1+512*(1+512)))))<<x) | " & _
        "CASE WHEN iword=0 THEN ((8-1)*(1+512*(1+512)))<<(y/3*3*9+x/3*3) ELSE 0 END AS peers0, " & _
        "CASE WHEN iword=1 THEN (512-1)<<((y%6)*9) ELSE 0 END | " & _
        "((1 + 512 * (1 + 512)) << x) | " & _
        "CASE WHEN iword=1 THEN ((8-1)*(1+512*(1+512)))<<((y%6)/3*3*9+x/3*3) ELSE 0 END AS peers1 " & _
        "from (" & _
        "with xy AS (SELECT 0 AS xy UNION ALL SELECT xy+1 FROM xy WHERE xy < 80) " & _
        "select  xy+1 AS i, " & _
        "xy%9 AS x, " & _
        "xy/9 AS y, " & _
        "xy/54 AS iword, " & _
        "xy%54 AS ibit " & _
        "from xy" & _
        ")" & _
        ";"

If $SQLITE_OK <> _SQLite_Exec($hDB, $sTempCreate) Then
    ConsoleWrite(@LF & "! your version of sqlite.dll is too old !" & @LF & @LF)
    Exit 4
EndIf

Local $aRows, $iRows, $iCols
Local $sProblem, $tTimer = TimerInit(), $sAll = ""

For $n = 0 To UBound($aSudokus) - 1
    $tTimer = TimerInit()
    $sProblem = InsaneSolver($aSudokus[$n][0], $aSudokus[$n][1]) ;  StringReplace($sInsaneSolver, "#####", $aSudokus[$n][0])
    _SQLite_GetTable($hDB, $sProblem, $aRows, $iRows, $iCols)
;~  _ConsoleWrite($aSudokus[$n][0] & " problem" & @CRLF & $aRows[2] & @CRLF & @CRLF)
;~  _ConsoleWrite($aSudokus[$n][0] & " solution" & @CRLF & $aRows[3] & @CRLF )
    _ConsoleWrite($aSudokus[$n][0] & " took " & Round(TimerDiff($tTimer) / 1000, 3) & " sec. to solve" & @CRLF)
Next
ClipPut($sAll) ; to paste on notepad

Func _ConsoleWrite($s)
    $sAll &= $s
    ConsoleWrite(BinaryToString(StringToBinary($s, 4), 1))
EndFunc   ;==>_ConsoleWrite

Func InsaneSolver($desc, $sudoku)
    Local $sInsaneSolver = "" & _
            "with   z AS (SELECT 1 AS z UNION ALL SELECT z+1 FROM z WHERE z < 9), " & _
            "input as (" & _
            "select  input, " & _
            "sud, " & _
            "ifnull (sum (word0), 0) as w0, " & _
            "ifnull (sum (word1), 0) as w1, " & _
            "ifnull (sum (case when z=1 then word0 end), 0) as w10, " & _
            "ifnull (sum (case when z=1 then word1 end), 0) as w11, " & _
            "ifnull (sum (case when z=2 then word0 end), 0) as w20, " & _
            "ifnull (sum (case when z=2 then word1 end), 0) as w21, " & _
            "ifnull (sum (case when z=3 then word0 end), 0) as w30, " & _
            "ifnull (sum (case when z=3 then word1 end), 0) as w31, " & _
            "ifnull (sum (case when z=4 then word0 end), 0) as w40, " & _
            "ifnull (sum (case when z=4 then word1 end), 0) as w41, " & _
            "ifnull (sum (case when z=5 then word0 end), 0) as w50, " & _
            "ifnull (sum (case when z=5 then word1 end), 0) as w51, " & _
            "ifnull (sum (case when z=6 then word0 end), 0) as w60, " & _
            "ifnull (sum (case when z=6 then word1 end), 0) as w61, " & _
            "ifnull (sum (case when z=7 then word0 end), 0) as w70, " & _
            "ifnull (sum (case when z=7 then word1 end), 0) as w71, " & _
            "ifnull (sum (case when z=8 then word0 end), 0) as w80, " & _
            "ifnull (sum (case when z=8 then word1 end), 0) as w81, " & _
            "ifnull (sum (case when z=9 then word0 end), 0) as w90, " & _
            "ifnull (sum (case when z=9 then word1 end), 0) as w91, " & _
            "count (*) as fixed, " & _
            "ifnull (sum (z=1), 0) as f1, " & _
            "ifnull (sum (z=2), 0) as f2, " & _
            "ifnull (sum (z=3), 0) as f3, " & _
            "ifnull (sum (z=4), 0) as f4, " & _
            "ifnull (sum (z=5), 0) as f5, " & _
            "ifnull (sum (z=6), 0) as f6, " & _
            "ifnull (sum (z=7), 0) as f7, " & _
            "ifnull (sum (z=8), 0) as f8, " & _
            "ifnull (sum (z=9), 0) as f9 " & _
            "from ( " & _
            "select '" & $desc & "' as input, " & _
            "'" & $sudoku & "' as sud " & _
            ") " & _
            "join i " & _
            "join z on z = cast (substr (sud, i.i, 1) as int) " & _
            "where input='" & $desc & "' " & _
            ") " & _
            ", " & _
            "sudoku as (" & _
            "select " & _
            "'' as text, " & _
            "fixed, " & _
            "f1,f2,f3,f4,f5,f6,f7,f8,f9, " & _
            "0 as zfixed, " & _
            "0 as i0, " & _
            "w0, w1, " & _
            "w10, w11, " & _
            "w20, w21, " & _
            "w30, w31, " & _
            "w40, w41, " & _
            "w50, w51, " & _
            "w60, w61, " & _
            "w70, w71, " & _
            "w80, w81, " & _
            "w90, w91 " & _
            "from input " & _
            "union all " & _
            "select " & _
            "(fixed+1)||','|| " & _
            "name||','|| " & _
            "( " & _
            "(w10&peers0 or w11&peers1) + " & _
            "(w20&peers0 or w21&peers1) + " & _
            "(w30&peers0 or w31&peers1) + " & _
            "(w40&peers0 or w41&peers1) + " & _
            "(w50&peers0 or w51&peers1) + " & _
            "(w60&peers0 or w61&peers1) + " & _
            "(w70&peers0 or w71&peers1) + " & _
            "(w80&peers0 or w81&peers1) + " & _
            "(w90&peers0 or w91&peers1) " & _
            ") ||','|| " & _
            "z||','|| " & _
            "'', " & _
            "fixed+1, " & _
            "f1+(z=1), " & _
            "f2+(z=2), " & _
            "f3+(z=3), " & _
            "f4+(z=4), " & _
            "f5+(z=5), " & _
            "f6+(z=6), " & _
            "f7+(z=7), " & _
            "f8+(z=8), " & _
            "f9+(z=9), " & _
            "case z " & _
            "when 1 then f1 " & _
            "when 2 then f2 " & _
            "when 3 then f3 " & _
            "when 4 then f4 " & _
            "when 5 then f5 " & _
            "when 6 then f6 " & _
            "when 7 then f7 " & _
            "when 8 then f8 " & _
            "when 9 then f9 " & _
            "end, " & _
            "i.i, " & _
            "w0+word0, " & _
            "w1+word1, " & _
            "case when z=1 then w10+word0 else w10 end, " & _
            "case when z=1 then w11+word1 else w11 end, " & _
            "case when z=2 then w20+word0 else w20 end, " & _
            "case when z=2 then w21+word1 else w21 end, " & _
            "case when z=3 then w30+word0 else w30 end, " & _
            "case when z=3 then w31+word1 else w31 end, " & _
            "case when z=4 then w40+word0 else w40 end, " & _
            "case when z=4 then w41+word1 else w41 end, " & _
            "case when z=5 then w50+word0 else w50 end, " & _
            "case when z=5 then w51+word1 else w51 end, " & _
            "case when z=6 then w60+word0 else w60 end, " & _
            "case when z=6 then w61+word1 else w61 end, " & _
            "case when z=7 then w70+word0 else w70 end, " & _
            "case when z=7 then w71+word1 else w71 end, " & _
            "case when z=8 then w80+word0 else w80 end, " & _
            "case when z=8 then w81+word1 else w81 end, " & _
            "case when z=9 then w90+word0 else w90 end, " & _
            "case when z=9 then w91+word1 else w91 end " & _
            "from sudoku " & _
            "join i " & _
            "on i = ifnull ( " & _
            "( " & _
            "select  i " & _
            "from    i " & _
            "where   i > i0 " & _
            "and     not (word0&w0 or word1&w1) " & _
            "and     ( " & _
            "(w10&peers0 or w11&peers1) + " & _
            "(w20&peers0 or w21&peers1) + " & _
            "(w30&peers0 or w31&peers1) + " & _
            "(w40&peers0 or w41&peers1) + " & _
            "(w50&peers0 or w51&peers1) + " & _
            "(w60&peers0 or w61&peers1) + " & _
            "(w70&peers0 or w71&peers1) + " & _
            "(w80&peers0 or w81&peers1) + " & _
            "(w90&peers0 or w91&peers1) " & _
            ") = 8 " & _
            "limit 1 " & _
            ") " & _
            ", " & _
            "( " & _
            "select  i " & _
            "from    ( " & _
            "select  i, " & _
            "max ( " & _
            "(w10&peers0 or w11&peers1) + " & _
            "(w20&peers0 or w21&peers1) + " & _
            "(w30&peers0 or w31&peers1) + " & _
            "(w40&peers0 or w41&peers1) + " & _
            "(w50&peers0 or w51&peers1) + " & _
            "(w60&peers0 or w61&peers1) + " & _
            "(w70&peers0 or w71&peers1) + " & _
            "(w80&peers0 or w81&peers1) + " & _
            "(w90&peers0 or w91&peers1) " & _
            ") as maxfixed " & _
            "from    i " & _
            "where   not (word0&w0 or word1&w1) " & _
            ") " & _
            "where     maxfixed is not null " & _
            ")) " & _
            "join    z " & _
            "on " & _
            "case z " & _
            "when 1 then not (w10&peers0 or w11&peers1) " & _
            "when 2 then not (w20&peers0 or w21&peers1) " & _
            "when 3 then not (w30&peers0 or w31&peers1) " & _
            "when 4 then not (w40&peers0 or w41&peers1) " & _
            "when 5 then not (w50&peers0 or w51&peers1) " & _
            "when 6 then not (w60&peers0 or w61&peers1) " & _
            "when 7 then not (w70&peers0 or w71&peers1) " & _
            "when 8 then not (w80&peers0 or w81&peers1) " & _
            "when 9 then not (w90&peers0 or w91&peers1) " & _
            "end " & _
            "order by fixed desc, " & _
            "zfixed desc " & _
            ") " & _
            ", " & _
            "output as ( " & _
            "select  * " & _
            "from    ( " & _
            "select  1 as i, " & _
            "w10, w11, " & _
            "w20, w21, " & _
            "w30, w31, " & _
            "w40, w41, " & _
            "w50, w51, " & _
            "w60, w61, " & _
            "w70, w71, " & _
            "w80, w81, " & _
            "w90, w91, " & _
            "'' as sud " & _
            "from    sudoku " & _
            "where   fixed = 81 limit 1 " & _
            ") " & _
            "union all " & _
            "select  nullif (output.i + 1, 82), " & _
            "w10, w11, " & _
            "w20, w21, " & _
            "w30, w31, " & _
            "w40, w41, " & _
            "w50, w51, " & _
            "w60, w61, " & _
            "w70, w71, " & _
            "w80, w81, " & _
            "w90, w91, " & _
            "sud || replace (cast ( " & _
            "case 1 " & _
            "when w10&word0 OR w11&word1 then 1 " & _
            "when w20&word0 OR w21&word1 then 2 " & _
            "when w30&word0 OR w31&word1 then 3 " & _
            "when w40&word0 OR w41&word1 then 4 " & _
            "when w50&word0 OR w51&word1 then 5 " & _
            "when w60&word0 OR w61&word1 then 6 " & _
            "when w70&word0 OR w71&word1 then 7 " & _
            "when w80&word0 OR w81&word1 then 8 " & _
            "when w90&word0 OR w91&word1 then 9 " & _
            "else 0 " & _
            "end " & _
            "as char), '0', '.') " & _
            "from    output " & _
            "join    i on i.i = output.i " & _
            ") " & _
            ", " & _
            "result as (select sud s from input union all select sud from output WHERE i is null) " & _
            "SELECT " & _
            "'┏━┯━┯━┳━┯━┯━┳━┯━┯━┓' || x'0d0a' || " & _
            "'┃' || substr(s, 1,1) || '│' || substr(s, 2,1) || '│' || substr(s, 3,1) || '┃' || " & _
            "substr(s, 4,1) || '│' || substr(s, 5,1) || '│' || substr(s, 6,1) || '┃' || " & _
            "substr(s, 7,1) || '│' || substr(s, 8,1) || '│' || substr(s, 9,1) || '┃' || x'0d0a' || " & _
            "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
            "'┃' || substr(s,10,1) || '│' || substr(s,11,1) || '│' || substr(s,12,1) || '┃' || " & _
            "substr(s,13,1) || '│' || substr(s,14,1) || '│' || substr(s,15,1) || '┃' || " & _
            "substr(s,16,1) || '│' || substr(s,17,1) || '│' || substr(s,18,1) || '┃' || x'0d0a' || " & _
            "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
            "'┃' || substr(s,19,1) || '│' || substr(s,20,1) || '│' || substr(s,21,1) || '┃' || " & _
            "substr(s,22,1) || '│' || substr(s,23,1) || '│' || substr(s,24,1) || '┃' || " & _
            "substr(s,25,1) || '│' || substr(s,26,1) || '│' || substr(s,27,1) || '┃' || x'0d0a' || " & _
            "'┣━┿━┿━╋━┿━┿━╋━┿━┿━┫' || x'0d0a' || " & _
            "'┃' || substr(s,28,1) || '│' || substr(s,29,1) || '│' || substr(s,30,1) || '┃' || " & _
            "substr(s,31,1) || '│' || substr(s,32,1) || '│' || substr(s,33,1) || '┃' || " & _
            "substr(s,34,1) || '│' || substr(s,35,1) || '│' || substr(s,36,1) || '┃' || x'0d0a' || " & _
            "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
            "'┃' || substr(s,37,1) || '│' || substr(s,38,1) || '│' || substr(s,39,1) || '┃' || " & _
            "substr(s,40,1) || '│' || substr(s,41,1) || '│' || substr(s,42,1) || '┃' || " & _
            "substr(s,43,1) || '│' || substr(s,44,1) || '│' || substr(s,45,1) || '┃' || x'0d0a' || " & _
            "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
            "'┃' || substr(s,46,1) || '│' || substr(s,47,1) || '│' || substr(s,48,1) || '┃' || " & _
            "substr(s,49,1) || '│' || substr(s,50,1) || '│' || substr(s,51,1) || '┃' || " & _
            "substr(s,52,1) || '│' || substr(s,53,1) || '│' || substr(s,54,1) || '┃' || x'0d0a' || " & _
            "'┣━┿━┿━╋━┿━┿━╋━┿━┿━┫' || x'0d0a' || " & _
            "'┃' || substr(s,55,1) || '│' || substr(s,56,1) || '│' || substr(s,57,1) || '┃' || " & _
            "substr(s,58,1) || '│' || substr(s,59,1) || '│' || substr(s,60,1) || '┃' || " & _
            "substr(s,61,1) || '│' || substr(s,62,1) || '│' || substr(s,63,1) || '┃' || x'0d0a' || " & _
            "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
            "'┃' || substr(s,64,1) || '│' || substr(s,65,1) || '│' || substr(s,66,1) || '┃' || " & _
            "substr(s,67,1) || '│' || substr(s,68,1) || '│' || substr(s,69,1) || '┃' || " & _
            "substr(s,70,1) || '│' || substr(s,71,1) || '│' || substr(s,72,1) || '┃' || x'0d0a' || " & _
            "'┠┄┼┄┼┄╂┄┼┄┼┄╂┄┼┄┼┄┨' || x'0d0a' || " & _
            "'┃' || substr(s,73,1) || '│' || substr(s,74,1) || '│' || substr(s,75,1) || '┃' || " & _
            "substr(s,76,1) || '│' || substr(s,77,1) || '│' || substr(s,78,1) || '┃' || " & _
            "substr(s,79,1) || '│' || substr(s,80,1) || '│' || substr(s,81,1) || '┃' || x'0d0a' || " & _
            "'┗━┷━┷━┻━┷━┷━┻━┷━┷━┛'" & _
            "FROM result;"
    Return $sInsaneSolver
EndFunc   ;==>InsaneSolver

Func GenArray()
    ; this list is from http://norvig.com/sudoku.html ponying to the top 95 hardest ( http://magictour.free.fr/top95 )
    Local $s = ""
    $s &= ",4.....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......"
    $s &= ",52...6.........7.13...........4..8..6......5...........418.........3..2...87....."
    $s &= ",6.....8.3.4.7.................5.4.7.3..2.....1.6.......2.....5.....8.6......1...."
    $s &= ",48.3............71.2.......7.5....6....2..8.............1.76...3.....4......5...."
    $s &= ",....14....3....2...7..........9...3.6.1.............8.2.....1.4....5.6.....7.8..."
    $s &= ",......52..8.4......3...9...5.1...6..2..7........3.....6...1..........7.4.......3."
    $s &= ",6.2.5.........3.4..........43...8....1....2........7..5..27...........81...6....."
    $s &= ",.524.........7.1..............8.2...3.....6...9.5.....1.6.3...........897........"
    $s &= ",6.2.5.........4.3..........43...8....1....2........7..5..27...........81...6....."
    $s &= ",.923.........8.1...........1.7.4...........658.........6.5.2...4.....7.....9....."
    $s &= ",6..3.2....5.....1..........7.26............543.........8.15........4.2........7.."
    $s &= ",.6.5.1.9.1...9..539....7....4.8...7.......5.8.817.5.3.....5.2............76..8..."
    $s &= ",..5...987.4..5...1..7......2...48....9.1.....6..2.....3..6..2.......9.7.......5.."
    $s &= ",3.6.7...........518.........1.4.5...7.....6.....2......2.....4.....8.3.....5....."
    $s &= ",1.....3.8.7.4..............2.3.1...........958.........5.6...7.....8.2...4......."
    $s &= ",6..3.2....4.....1..........7.26............543.........8.15........4.2........7.."
    $s &= ",....3..9....2....1.5.9..............1.2.8.4.6.8.5...2..75......4.1..6..3.....4.6."
    $s &= ",45.....3....8.1....9...........5..9.2..7.....8.........1..4..........7.2...6..8.."
    $s &= ",.237....68...6.59.9.....7......4.97.3.7.96..2.........5..47.........2....8......."
    $s &= ",..84...3....3.....9....157479...8........7..514.....2...9.6...2.5....4......9..56"
    $s &= ",.98.1....2......6.............3.2.5..84.........6.........4.8.93..5...........1.."
    $s &= ",..247..58..............1.4.....2...9528.9.4....9...1.........3.3....75..685..2..."
    $s &= ",4.....8.5.3..........7......2.....6.....5.4......1.......6.3.7.5..2.....1.9......"
    $s &= ",.2.3......63.....58.......15....9.3....7........1....8.879..26......6.7...6..7..4"
    $s &= ",1.....7.9.4...72..8.........7..1..6.3.......5.6..4..2.........8..53...7.7.2....46"
    $s &= ",4.....3.....8.2......7........1...8734.......6........5...6........1.4...82......"
    $s &= ",.......71.2.8........4.3...7...6..5....2..3..9........6...7.....8....4......5...."
    $s &= ",6..3.2....4.....8..........7.26............543.........8.15........8.2........7.."
    $s &= ",.47.8...1............6..7..6....357......5....1..6....28..4.....9.1...4.....2.69."
    $s &= ",......8.17..2........5.6......7...5..1....3...8.......5......2..4..8....6...3...."
    $s &= ",38.6.......9.......2..3.51......5....3..1..6....4......17.5..8.......9.......7.32"
    $s &= ",...5...........5.697.....2...48.2...25.1...3..8..3.........4.7..13.5..9..2...31.."
    $s &= ",.2.......3.5.62..9.68...3...5..........64.8.2..47..9....3.....1.....6...17.43...."
    $s &= ",.8..4....3......1........2...5...4.69..1..8..2...........3.9....6....5.....2....."
    $s &= ",..8.9.1...6.5...2......6....3.1.7.5.........9..4...3...5....2...7...3.8.2..7....4"
    $s &= ",4.....5.8.3..........7......2.....6.....5.8......1.......6.3.7.5..2.....1.8......"
    $s &= ",1.....3.8.6.4..............2.3.1...........958.........5.6...7.....8.2...4......."
    $s &= ",1....6.8..64..........4...7....9.6...7.4..5..5...7.1...5....32.3....8...4........"
    $s &= ",249.6...3.3....2..8.......5.....6......2......1..4.82..9.5..7....4.....1.7...3..."
    $s &= ",...8....9.873...4.6..7.......85..97...........43..75.......3....3...145.4....2..1"
    $s &= ",...5.1....9....8...6.......4.1..........7..9........3.8.....1.5...2..4.....36...."
    $s &= ",......8.16..2........7.5......6...2..1....3...8.......2......7..3..8....5...4...."
    $s &= ",.476...5.8.3.....2.....9......8.5..6...1.....6.24......78...51...6....4..9...4..7"
    $s &= ",.....7.95.....1...86..2.....2..73..85......6...3..49..3.5...41724................"
    $s &= ",.4.5.....8...9..3..76.2.....146..........9..7.....36....1..4.5..6......3..71..2.."
    $s &= ",.834.........7..5...........4.1.8..........27...3.....2.6.5....5.....8........1.."
    $s &= ",..9.....3.....9...7.....5.6..65..4.....3......28......3..75.6..6...........12.3.8"
    $s &= ",.26.39......6....19.....7.......4..9.5....2....85.....3..2..9..4....762.........4"
    $s &= ",2.3.8....8..7...........1...6.5.7...4......3....1............82.5....6...1......."
    $s &= ",6..3.2....1.....5..........7.26............843.........8.15........8.2........7.."
    $s &= ",1.....9...64..1.7..7..4.......3.....3.89..5....7....2.....6.7.9.....4.1....129.3."
    $s &= ",.........9......84.623...5....6...453...1...6...9...7....1.....4.5..2....3.8....9"
    $s &= ",.2....5938..5..46.94..6...8..2.3.....6..8.73.7..2.........4.38..7....6..........5"
    $s &= ",9.4..5...25.6..1..31......8.7...9...4..26......147....7.......2...3..8.6.4.....9."
    $s &= ",...52.....9...3..4......7...1.....4..8..453..6...1...87.2........8....32.4..8..1."
    $s &= ",53..2.9...24.3..5...9..........1.827...7.........981.............64....91.2.5.43."
    $s &= ",1....786...7..8.1.8..2....9........24...1......9..5...6.8..........5.9.......93.4"
    $s &= ",....5...11......7..6.....8......4.....9.1.3.....596.2..8..62..7..7......3.5.7.2.."
    $s &= ",.47.2....8....1....3....9.2.....5...6..81..5.....4.....7....3.4...9...1.4..27.8.."
    $s &= ",......94.....9...53....5.7..8.4..1..463...........7.8.8..7.....7......28.5.26...."
    $s &= ",.2......6....41.....78....1......7....37.....6..412....1..74..5..8.5..7......39.."
    $s &= ",1.....3.8.6.4..............2.3.1...........758.........7.5...6.....8.2...4......."
    $s &= ",2....1.9..1..3.7..9..8...2.......85..6.4.........7...3.2.3...6....5.....1.9...2.5"
    $s &= ",..7..8.....6.2.3...3......9.1..5..6.....1.....7.9....2........4.83..4...26....51."
    $s &= ",...36....85.......9.4..8........68.........17..9..45...1.5...6.4....9..2.....3..."
    $s &= ",34.6.......7.......2..8.57......5....7..1..2....4......36.2..1.......9.......7.82"
    $s &= ",......4.18..2........6.7......8...6..4....3...1.......6......2..5..1....7...3...."
    $s &= ",.4..5..67...1...4....2.....1..8..3........2...6...........4..5.3.....8..2........"
    $s &= ",.......4...2..4..1.7..5..9...3..7....4..6....6..1..8...2....1..85.9...6.....8...3"
    $s &= ",8..7....4.5....6............3.97...8....43..5....2.9....6......2...6...7.71..83.2"
    $s &= ",.8...4.5....7..3............1..85...6.....2......4....3.26............417........"
    $s &= ",....7..8...6...5...2...3.61.1...7..2..8..534.2..9.......2......58...6.3.4...1...."
    $s &= ",......8.16..2........7.5......6...2..1....3...8.......2......7..4..8....5...3...."
    $s &= ",.2..........6....3.74.8.........3..2.8..4..1.6..5.........1.78.5....9..........4."
    $s &= ",.52..68.......7.2.......6....48..9..2..41......1.....8..61..38.....9...63..6..1.9"
    $s &= ",....1.78.5....9..........4..2..........6....3.74.8.........3..2.8..4..1.6..5....."
    $s &= ",1.......3.6.3..7...7...5..121.7...9...7........8.1..2....8.64....9.2..6....4....."
    $s &= ",4...7.1....19.46.5.....1......7....2..2.3....847..6....14...8.6.2....3..6...9...."
    $s &= ",......8.17..2........5.6......7...5..1....3...8.......5......2..3..8....6...4...."
    $s &= ",963......1....8......2.5....4.8......1....7......3..257......3...9.2.4.7......9.."
    $s &= ",15.3......7..4.2....4.72.....8.........9..1.8.1..8.79......38...........6....7423"
    $s &= ",..........5724...98....947...9..3...5..9..12...3.1.9...6....25....56.....7......6"
    $s &= ",....75....1..2.....4...3...5.....3.2...8...1.......6.....1..48.2........7........"
    $s &= ",6.....7.3.4.8.................5.4.8.7..2.....1.3.......2.....5.....7.9......1...."
    $s &= ",....6...4..6.3....1..4..5.77.....8.5...8.....6.8....9...2.9....4....32....97..1.."
    $s &= ",.32.....58..3.....9.428...1...4...39...6...5.....1.....2...67.8.....4....95....6."
    $s &= ",...5.3.......6.7..5.8....1636..2.......4.1.......3...567....2.8..4.7.......2..5.."
    $s &= ",.5.3.7.4.1.........3.......5.8.3.61....8..5.9.6..1........4...6...6927....2...9.."
    $s &= ",..5..8..18......9.......78....4.....64....9......53..2.6.........138..5....9.714."
    $s &= ",..........72.6.1....51...82.8...13..4.........37.9..1.....238..5.4..9.........79."
    $s &= ",...658.....4......12............96.7...3..5....2.8...3..19..8..3.6.....4....473.."
    $s &= ",.2.3.......6..8.9.83.5........2...8.7.9..5........6..4.......1...1...4.22..7..8.9"
    $s &= ",.5..9....1.....6.....3.8.....8.4...9514.......3....2..........4.8...6..77..15..6."
    $s &= ",.....2.......7...17..3...9.8..7......2.89.6...13..6....9..5.824.....891.........."
    $s &= ",3...8.......7....51..............36...2..4....7...........6.13..452...........8.."

    Local $a = StringSplit($s, ",")
    Local $n, $b[UBound($a) - 2][2]
    For $n = 0 To UBound($a) - 3
        $b[$n][0] = "From TOP 95: # " & $n + 1
        $b[$n][1] = $a[$n + 2]
    Next
    $aSudokus = $b
EndFunc   ;==>GenArray

 

and that is a hell of a lot faster than the backtracking algorithm

Spoiler
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GuiOnEventMode", 1)

Global $aSudokusChoice = 0
Global $aSudokus[10][2] = [ _
        ["Easy          ( average time to solve: 0 sec. )", "53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79"], _ ; 0 in 0 sec.
        ["Sqlite        ( average time to solve: 10 sec. )", "1....7.9..3..2...8..96..5....53..9...1..8...26....4...3......1..4......7..7...3.."], _ ; 1 in 11 sec.
        ["Hard          ( average time to solve: 0 sec. )", ".....6....59.....82....8....45........3........6..3.54...325..6.................."], _ ; 2 in 0 sec.
        ["Hola          ( average time to solve: 0 sec. )", "4.2....3.1..6.5.299.....1......42....8.9.1.5....85......3.....861.5.4..2.4....5.7"], _ ; 3 in 0 sec.
        ["Hardest       ( average time to solve: 310 sec. )", "8..........36......7..9.2...5...7.......457.....1...3...1....68..85...1..9....4.."], _ ; 4 in 307 sec.
        ["EasterMonster ( average time to solve: 30 sec. )", "1.......2.9.4...5...6...7...5.9.3.......7.......85..4.7.....6...3...9.8...2.....1"], _ ; 5 in 30 sec.
        ["Post #16      ( average time to solve: 1 sec. )", ".61..7..3.92..3..............853..........5.45....8....4......1...16.8..6........"], _ ; 6 in 1 sec.
        ["Evil 2952797052  ", ".8.....73.1...5.....6..49......18..7.5..6..3.3..59......41..2.....7...4.13.....8."], _ ; http://www.websudoku.com/?level=4&set_id=2952797052
        ["Evil 62282525    ", "47...8........32..1......6..9.12.5....4...1....1.37.2..2......9..69........2...18"], _ ; http://www.websudoku.com/?level=4&set_id=62282525
        ["Easy 1798574274  ", ".......72..3..8.4.64.7....537.2.91.89.5.8.6.78.63.7.294....5.61.6.9..7..28......."] _ ; http://www.websudoku.com/?level=1&set_id=1798574274
        ]

GenArray() ; do away with the original array and replace with this sample

Global $width = 800, $height = 600
Global $FieldSize = [5, 35, $width - 10, $height - 60]
Global $Fields[9][9][4], $Space = 10, $FieldWidth = ($FieldSize[2] - ($Space * UBound($Fields) - 1)) / 9, $FieldHeight = ($FieldSize[3] - ($Space * UBound($Fields, 2) - 1)) / 9, $LabelsW[Int((UBound($Fields)) / 3)], $LabelsH[Int((UBound($Fields, 2)) / 3)]
Global $Solved = False, $solving = False
$Gui = GUICreate("SudokuSolver", $width, $height)
Global $NewButton = GUICtrlCreateButton("New Sudoku: " & $aSudokus[$aSudokusChoice][0], 5, 5, $width - 10, 25)
GUICtrlSetOnEvent(-1, "_newSudokuChoose")

Global $idSudokusDummy = GUICtrlCreateDummy()
Global $idSudokusContext = GUICtrlCreateContextMenu($idSudokusDummy)
For $n = 0 To UBound($aSudokus) - 1
    GUICtrlCreateMenuItem($aSudokus[$n][0], $idSudokusContext)
    GUICtrlSetOnEvent(-1, "_newSudokuChoice")
Next

$SolveButton = GUICtrlCreateButton("Solve Sudoku", 5, $height - 30, $width - 10, 25)
GUICtrlSetOnEvent(-1, "_buttonSolveSodoku")
GUISetState(@SW_SHOW, $Gui)
GUISetOnEvent($GUI_EVENT_CLOSE, "_close")
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
$dummy = GUICtrlCreateDummy()
Global $AccelKeys[1][2] = [["{TAB}", $dummy]]
GUICtrlSetOnEvent($dummy, "_TabNext")
GUISetAccelerators($AccelKeys, $Gui)

Global $SEC = @SEC, $Ttimer = TimerInit()

Func _newSudokuChoose()
    ShowMenu($Gui, $NewButton, $idSudokusContext)
EndFunc   ;==>_newSudokuChoose
Func _newSudokuChoice()
    ConsoleWrite(GUICtrlRead(@GUI_CtrlId, 1) & @CRLF)
    For $n = 0 To UBound($aSudokus) - 1
        If GUICtrlRead(@GUI_CtrlId, 1) = $aSudokus[$n][0] Then
            $aSudokusChoice = $n
            GUICtrlSetData($NewButton, "New Sudoku: " & $aSudokus[$aSudokusChoice][0])
            _newSudoku()
        EndIf
    Next
EndFunc   ;==>_newSudokuChoice


_newSudoku()

While Sleep(10)
WEnd

Func _newSudoku()
;~  $N = ".61..7..3.92..3..............853..........5.45....8....4......1...16.8..6........"
    $n = $aSudokus[$aSudokusChoice][1]
    $n = StringSplit($n, "", 2)
    $Solved = False
    For $i = 0 To UBound($Fields) - 1 Step 1
        For $j = 0 To UBound($Fields, 2) - 1 Step 1
            GUICtrlDelete($Fields[$i][$j][0])
        Next
    Next
    For $i = 0 To UBound($LabelsW) - 1 Step 1
        GUICtrlDelete($LabelsW[$i])
    Next
    For $i = 0 To UBound($LabelsH) - 1 Step 1
        GUICtrlDelete($LabelsH[$i])
    Next
    $Nx = 0
    For $j = 0 To UBound($Fields, 2) - 1 Step 1
        For $i = 0 To UBound($Fields) - 1 Step 1
            $Fields[$i][$j][0] = GUICtrlCreateInput("", $FieldSize[0] + ($FieldWidth + $Space) * $i, $FieldSize[1] + ($FieldHeight + $Space) * $j, $FieldWidth, $FieldHeight)
            If Not ($n[$Nx] = ".") Then GUICtrlSetData(-1, $n[$Nx])
            GUICtrlSetFont(-1, $FieldHeight / 2)
            $Nx += 1
        Next
    Next
    For $i = 3 To UBound($Fields) - 1 Step 3
        $LabelsW[Int($i / 3) - 1] = GUICtrlCreateLabel("", $FieldSize[0] + $i * $FieldWidth + $i * $Space - $Space, $FieldSize[1], $Space, $FieldHeight * 9 + $Space * 8)
        GUICtrlSetBkColor(-1, 0x000000)
    Next
    For $i = 3 To UBound($Fields, 2) - 1 Step 3
        $LabelsH[Int($i / 3) - 1] = GUICtrlCreateLabel("", $FieldSize[0], $FieldSize[1] + $i * $FieldHeight + $i * $Space - $Space, $FieldWidth * 9 + $Space * 8, $Space)
        GUICtrlSetBkColor(-1, 0x000000)
    Next
EndFunc   ;==>_newSudoku

Func _buttonSolveSodoku()
    $Ttimer = TimerInit()
    GUICtrlSetState($SolveButton, $GUI_DISABLE)
    GUICtrlSetState($NewButton, $GUI_DISABLE)
    If $Solved Then
        For $i = 0 To UBound($Fields) - 1 Step 1
            For $j = 0 To UBound($Fields, 2) - 1 Step 1
                GUICtrlSetData($Fields[$i][$j][0], $Fields[$i][$j][2])
            Next
        Next
        $Solved = False
        GUICtrlSetData($SolveButton, "Solve Sudoku")
        GUICtrlSetState($SolveButton, $GUI_ENABLE)
        GUICtrlSetState($NewButton, $GUI_ENABLE)
    Else
        $solving = True
        For $i = 0 To UBound($Fields) - 1 Step 1
            For $j = 0 To UBound($Fields, 2) - 1 Step 1
                $Fields[$i][$j][1] = GUICtrlRead($Fields[$i][$j][0])
                $Fields[$i][$j][2] = $Fields[$i][$j][1]
                GUICtrlSetState($Fields[$i][$j][0], $GUI_DISABLE)
            Next
        Next
        $maybePossible = True
        For $i = 0 To UBound($Fields) - 1 Step 1
            For $j = 0 To UBound($Fields, 2) - 1 Step 1
                If $Fields[$i][$j][1] <> "" Then
                    $Fields[$i][$j][1] = ""
                    If _check($i, $j, $Fields[$i][$j][2]) Then
                        GUICtrlSetBkColor($Fields[$i][$j][0], 0xFF0000)
                        MsgBox(16, "Error", "Das Sudoku ist nicht lösbar! Sudoku could not be solved!")
                        GUICtrlSetState($SolveButton, $GUI_ENABLE)
                        GUICtrlSetState($NewButton, $GUI_ENABLE)
                        $maybePossible = False
                        ExitLoop 2
                    EndIf
                    $Fields[$i][$j][1] = $Fields[$i][$j][2]
                EndIf
            Next
        Next
        If $maybePossible Then
            GUICtrlSetData($SolveButton, "Solving Sudoku...")
            If Not _solveSudoku(0, 0) Then
                MsgBox(16, "Error", "Das Sudoku ist nicht lösbar! Sudoku could not be solved!")
                GUICtrlSetState($SolveButton, $GUI_ENABLE)
                GUICtrlSetState($NewButton, $GUI_ENABLE)
                For $i = 0 To UBound($Fields) - 1 Step 1
                    For $j = 0 To UBound($Fields, 2) - 1 Step 1
                        $Fields[$i][$j][1] = 0
                        GUICtrlSetData($Fields[$i][$j][0], $Fields[$i][$j][2])
                    Next
                Next
            Else
                $Solved = True
                For $i = 0 To UBound($Fields) - 1 Step 1
                    For $j = 0 To UBound($Fields, 2) - 1 Step 1
;~                      $Fields[$i][$j][1] = 0
                        If $Fields[$i][$j][3] Then GUICtrlSetData($Fields[$i][$j][0], $Fields[$i][$j][3])
                        $Fields[$i][$j][3] = ""

                    Next
                Next
                GUICtrlSetState($SolveButton, $GUI_ENABLE)
                GUICtrlSetState($NewButton, $GUI_ENABLE)
                GUICtrlSetData($SolveButton, "Reset Field - Solved in " & Round(TimerDiff($Ttimer) / 1000, 3) & " sec.")
            EndIf
        EndIf
        For $i = 0 To UBound($Fields) - 1 Step 1
            For $j = 0 To UBound($Fields, 2) - 1 Step 1
                GUICtrlSetState($Fields[$i][$j][0], $GUI_ENABLE)
            Next
        Next
        $solving = False
    EndIf
EndFunc   ;==>_buttonSolveSodoku

Func _solveSudoku($l, $r)
    If $l > UBound($Fields) - 1 Then
        Return True
    EndIf
    If $r > UBound($Fields, 2) - 1 Then
        Return _solveSudoku($l + 1, 0)
    EndIf
    If $Fields[$l][$r][1] > 0 Then
        Return _solveSudoku($l, $r + 1)
    EndIf
    For $i = 1 To UBound($Fields) Step 1
        If Not _check($l, $r, $i) Then
            $Fields[$l][$r][1] = $i
;~          GUICtrlSetData($Fields[$l][$r][0], $i)
            $Fields[$l][$r][3] = $i
            If _solveSudoku($l, $r) Then
                Return True
            EndIf
        EndIf
    Next
    $Fields[$l][$r][1] = 0
;~  GUICtrlSetData($Fields[$l][$r][0], 0)
    $Fields[$l][$r][3] = 0
    Return False
EndFunc   ;==>_solveSudoku

Func _check($l, $r, $zahl)
    If @SEC <> $SEC Then
        $SEC = @SEC
        For $i = 0 To UBound($Fields) - 1 Step 1
            For $j = 0 To UBound($Fields, 2) - 1 Step 1
;~              $Fields[$i][$j][1] = 0
                If $Fields[$i][$j][3] Then GUICtrlSetData($Fields[$i][$j][0], $Fields[$i][$j][3])
            Next
        Next
    EndIf

    If _checkRow($l, $zahl) Then
        Return True
    ElseIf _checkCol($r, $zahl) Then
        Return True
    ElseIf _checkBox($l, $r, $zahl) Then
        Return True
    EndIf
    Return False
EndFunc   ;==>_check

Func _checkRow($l, $zahl)
    For $i = 0 To UBound($Fields, 2) - 1 Step 1
        If $Fields[$l][$i][1] = $zahl Then
            Return True
        EndIf
    Next
    Return False
EndFunc   ;==>_checkRow

Func _checkCol($r, $zahl)
    For $i = 0 To UBound($Fields) - 1 Step 1
        If $Fields[$i][$r][1] = $zahl Then
            Return True
        EndIf
    Next
    Return False
EndFunc   ;==>_checkCol

Func _checkBox($l, $r, $zahl)
    $BoxL = Int($l / 3) * 3
    $BoxR = Int($r / 3) * 3
    For $i = $BoxL To $BoxL + 2 Step 1
        For $j = $BoxR To $BoxR + 2 Step 1
            If $Fields[$i][$j][1] = $zahl Then
                Return True
            EndIf
        Next
    Next
    Return False
EndFunc   ;==>_checkBox

Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    If Not $solving Then
        Local $nNotifyCode = BitShift($wParam, 16)
        Local $hCtrl = $lParam
        If $nNotifyCode = 1024 Or $nNotifyCode = 786 Then
            For $i = 0 To UBound($Fields) - 1 Step 1
                For $j = 0 To UBound($Fields, 2) - 1 Step 1
                    If $hCtrl = GUICtrlGetHandle($Fields[$i][$j][0]) Then
                        $data = GUICtrlRead($Fields[$i][$j][0])
                        If StringLen($data) > 1 Then
                            $data = StringMid($data, StringLen($data))
                        EndIf
                        If Not ($data = "1" Or $data = "2" Or $data = "3" Or $data = "4" Or $data = "5" Or $data = "6" Or $data = "7" Or $data = "8" Or $data = "9") Then
                            $data = ""
                            _selNext($i, $j)
                        EndIf
                        GUICtrlSetData($Fields[$i][$j][0], $data)
                        If $data <> "" Then
                            _selNext($i, $j)
                        EndIf
                        If $data <> "" Then
                            GUICtrlSetBkColor($Fields[$i][$j][0], 0xFFFF00)
                        Else
                            GUICtrlSetBkColor($Fields[$i][$j][0], 0xFFFFFF)
                        EndIf
                        $Solved = False
                        GUICtrlSetData($SolveButton, "Solve Sudoku")
                    EndIf
                Next
            Next
        EndIf
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>MY_WM_COMMAND

Func _selNext($i, $j)
    $x = $i
    $y = $j
    If $x + 1 > UBound($Fields) - 1 And $y + 1 > UBound($Fields, 2) - 1 Then
        $x = 0
        $y = 0
    ElseIf $y + 1 > UBound($Fields, 2) Then
        $x += 1
        $y = 0
    ElseIf $x + 1 > UBound($Fields) - 1 Then
        $x = 0
        $y += 1
    Else
        $x += 1
    EndIf
    GUICtrlSetState($Fields[$x][$y][0], $GUI_FOCUS)
EndFunc   ;==>_selNext

Func _TabNext()
    $a = ControlGetFocus("")
    $handle = ControlGetHandle($Gui, "", $a)
    For $i = 0 To UBound($Fields) - 1 Step 1
        For $j = 0 To UBound($Fields, 2) - 1 Step 1
            If GUICtrlGetHandle($Fields[$i][$j][0]) = $handle Then
                _selNext($i, $j)
                ExitLoop 2
            EndIf
        Next
    Next
EndFunc   ;==>_TabNext

Func _close()
    Exit
EndFunc   ;==>_close

; Show a menu in a given GUI window which belongs to a given GUI ctrl
Func ShowMenu($hWnd, $idCtrl, $idContext)
    Local $aPos, $x, $y
    Local $hMenu = GUICtrlGetHandle($idContext)
    $aPos = ControlGetPos($hWnd, "", $idCtrl)
    $x = $aPos[0]
    $y = $aPos[1] + $aPos[3]
    ClientToScreen($hWnd, $x, $y)
    TrackPopupMenu($hWnd, $hMenu, $x, $y)
EndFunc   ;==>ShowMenu

; Convert the client (GUI) coordinates to screen (desktop) coordinates
Func ClientToScreen($hWnd, ByRef $x, ByRef $y)
    Local $tPoint = DllStructCreate("int;int")
    DllStructSetData($tPoint, 1, $x)
    DllStructSetData($tPoint, 2, $y)
    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "struct*", $tPoint)
    $x = DllStructGetData($tPoint, 1)
    $y = DllStructGetData($tPoint, 2)
    ; release Struct not really needed as it is a local
    $tPoint = 0
EndFunc   ;==>ClientToScreen

; Show at the given coordinates (x, y) the popup menu (hMenu) which belongs to a given GUI window (hWnd)
Func TrackPopupMenu($hWnd, $hMenu, $x, $y)
    DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
EndFunc   ;==>TrackPopupMenu

Func GenArray()
    ; this list is from http://norvig.com/sudoku.html ponying to the top 95 hardest ( http://magictour.free.fr/top95 )
    Local $s = ""
    $s &= ",4.....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......"
    $s &= ",52...6.........7.13...........4..8..6......5...........418.........3..2...87....."
    $s &= ",6.....8.3.4.7.................5.4.7.3..2.....1.6.......2.....5.....8.6......1...."
    $s &= ",48.3............71.2.......7.5....6....2..8.............1.76...3.....4......5...."
    $s &= ",....14....3....2...7..........9...3.6.1.............8.2.....1.4....5.6.....7.8..."
    $s &= ",......52..8.4......3...9...5.1...6..2..7........3.....6...1..........7.4.......3."
    $s &= ",6.2.5.........3.4..........43...8....1....2........7..5..27...........81...6....."
    $s &= ",.524.........7.1..............8.2...3.....6...9.5.....1.6.3...........897........"
    $s &= ",6.2.5.........4.3..........43...8....1....2........7..5..27...........81...6....."
    $s &= ",.923.........8.1...........1.7.4...........658.........6.5.2...4.....7.....9....."
    $s &= ",6..3.2....5.....1..........7.26............543.........8.15........4.2........7.."
    $s &= ",.6.5.1.9.1...9..539....7....4.8...7.......5.8.817.5.3.....5.2............76..8..."
    $s &= ",..5...987.4..5...1..7......2...48....9.1.....6..2.....3..6..2.......9.7.......5.."
    $s &= ",3.6.7...........518.........1.4.5...7.....6.....2......2.....4.....8.3.....5....."
    $s &= ",1.....3.8.7.4..............2.3.1...........958.........5.6...7.....8.2...4......."
    $s &= ",6..3.2....4.....1..........7.26............543.........8.15........4.2........7.."
    $s &= ",....3..9....2....1.5.9..............1.2.8.4.6.8.5...2..75......4.1..6..3.....4.6."
    $s &= ",45.....3....8.1....9...........5..9.2..7.....8.........1..4..........7.2...6..8.."
    $s &= ",.237....68...6.59.9.....7......4.97.3.7.96..2.........5..47.........2....8......."
    $s &= ",..84...3....3.....9....157479...8........7..514.....2...9.6...2.5....4......9..56"
    $s &= ",.98.1....2......6.............3.2.5..84.........6.........4.8.93..5...........1.."
    $s &= ",..247..58..............1.4.....2...9528.9.4....9...1.........3.3....75..685..2..."
    $s &= ",4.....8.5.3..........7......2.....6.....5.4......1.......6.3.7.5..2.....1.9......"
    $s &= ",.2.3......63.....58.......15....9.3....7........1....8.879..26......6.7...6..7..4"
    $s &= ",1.....7.9.4...72..8.........7..1..6.3.......5.6..4..2.........8..53...7.7.2....46"
    $s &= ",4.....3.....8.2......7........1...8734.......6........5...6........1.4...82......"
    $s &= ",.......71.2.8........4.3...7...6..5....2..3..9........6...7.....8....4......5...."
    $s &= ",6..3.2....4.....8..........7.26............543.........8.15........8.2........7.."
    $s &= ",.47.8...1............6..7..6....357......5....1..6....28..4.....9.1...4.....2.69."
    $s &= ",......8.17..2........5.6......7...5..1....3...8.......5......2..4..8....6...3...."
    $s &= ",38.6.......9.......2..3.51......5....3..1..6....4......17.5..8.......9.......7.32"
    $s &= ",...5...........5.697.....2...48.2...25.1...3..8..3.........4.7..13.5..9..2...31.."
    $s &= ",.2.......3.5.62..9.68...3...5..........64.8.2..47..9....3.....1.....6...17.43...."
    $s &= ",.8..4....3......1........2...5...4.69..1..8..2...........3.9....6....5.....2....."
    $s &= ",..8.9.1...6.5...2......6....3.1.7.5.........9..4...3...5....2...7...3.8.2..7....4"
    $s &= ",4.....5.8.3..........7......2.....6.....5.8......1.......6.3.7.5..2.....1.8......"
    $s &= ",1.....3.8.6.4..............2.3.1...........958.........5.6...7.....8.2...4......."
    $s &= ",1....6.8..64..........4...7....9.6...7.4..5..5...7.1...5....32.3....8...4........"
    $s &= ",249.6...3.3....2..8.......5.....6......2......1..4.82..9.5..7....4.....1.7...3..."
    $s &= ",...8....9.873...4.6..7.......85..97...........43..75.......3....3...145.4....2..1"
    $s &= ",...5.1....9....8...6.......4.1..........7..9........3.8.....1.5...2..4.....36...."
    $s &= ",......8.16..2........7.5......6...2..1....3...8.......2......7..3..8....5...4...."
    $s &= ",.476...5.8.3.....2.....9......8.5..6...1.....6.24......78...51...6....4..9...4..7"
    $s &= ",.....7.95.....1...86..2.....2..73..85......6...3..49..3.5...41724................"
    $s &= ",.4.5.....8...9..3..76.2.....146..........9..7.....36....1..4.5..6......3..71..2.."
    $s &= ",.834.........7..5...........4.1.8..........27...3.....2.6.5....5.....8........1.."
    $s &= ",..9.....3.....9...7.....5.6..65..4.....3......28......3..75.6..6...........12.3.8"
    $s &= ",.26.39......6....19.....7.......4..9.5....2....85.....3..2..9..4....762.........4"
    $s &= ",2.3.8....8..7...........1...6.5.7...4......3....1............82.5....6...1......."
    $s &= ",6..3.2....1.....5..........7.26............843.........8.15........8.2........7.."
    $s &= ",1.....9...64..1.7..7..4.......3.....3.89..5....7....2.....6.7.9.....4.1....129.3."
    $s &= ",.........9......84.623...5....6...453...1...6...9...7....1.....4.5..2....3.8....9"
    $s &= ",.2....5938..5..46.94..6...8..2.3.....6..8.73.7..2.........4.38..7....6..........5"
    $s &= ",9.4..5...25.6..1..31......8.7...9...4..26......147....7.......2...3..8.6.4.....9."
    $s &= ",...52.....9...3..4......7...1.....4..8..453..6...1...87.2........8....32.4..8..1."
    $s &= ",53..2.9...24.3..5...9..........1.827...7.........981.............64....91.2.5.43."
    $s &= ",1....786...7..8.1.8..2....9........24...1......9..5...6.8..........5.9.......93.4"
    $s &= ",....5...11......7..6.....8......4.....9.1.3.....596.2..8..62..7..7......3.5.7.2.."
    $s &= ",.47.2....8....1....3....9.2.....5...6..81..5.....4.....7....3.4...9...1.4..27.8.."
    $s &= ",......94.....9...53....5.7..8.4..1..463...........7.8.8..7.....7......28.5.26...."
    $s &= ",.2......6....41.....78....1......7....37.....6..412....1..74..5..8.5..7......39.."
    $s &= ",1.....3.8.6.4..............2.3.1...........758.........7.5...6.....8.2...4......."
    $s &= ",2....1.9..1..3.7..9..8...2.......85..6.4.........7...3.2.3...6....5.....1.9...2.5"
    $s &= ",..7..8.....6.2.3...3......9.1..5..6.....1.....7.9....2........4.83..4...26....51."
    $s &= ",...36....85.......9.4..8........68.........17..9..45...1.5...6.4....9..2.....3..."
    $s &= ",34.6.......7.......2..8.57......5....7..1..2....4......36.2..1.......9.......7.82"
    $s &= ",......4.18..2........6.7......8...6..4....3...1.......6......2..5..1....7...3...."
    $s &= ",.4..5..67...1...4....2.....1..8..3........2...6...........4..5.3.....8..2........"
    $s &= ",.......4...2..4..1.7..5..9...3..7....4..6....6..1..8...2....1..85.9...6.....8...3"
    $s &= ",8..7....4.5....6............3.97...8....43..5....2.9....6......2...6...7.71..83.2"
    $s &= ",.8...4.5....7..3............1..85...6.....2......4....3.26............417........"
    $s &= ",....7..8...6...5...2...3.61.1...7..2..8..534.2..9.......2......58...6.3.4...1...."
    $s &= ",......8.16..2........7.5......6...2..1....3...8.......2......7..4..8....5...3...."
    $s &= ",.2..........6....3.74.8.........3..2.8..4..1.6..5.........1.78.5....9..........4."
    $s &= ",.52..68.......7.2.......6....48..9..2..41......1.....8..61..38.....9...63..6..1.9"
    $s &= ",....1.78.5....9..........4..2..........6....3.74.8.........3..2.8..4..1.6..5....."
    $s &= ",1.......3.6.3..7...7...5..121.7...9...7........8.1..2....8.64....9.2..6....4....."
    $s &= ",4...7.1....19.46.5.....1......7....2..2.3....847..6....14...8.6.2....3..6...9...."
    $s &= ",......8.17..2........5.6......7...5..1....3...8.......5......2..3..8....6...4...."
    $s &= ",963......1....8......2.5....4.8......1....7......3..257......3...9.2.4.7......9.."
    $s &= ",15.3......7..4.2....4.72.....8.........9..1.8.1..8.79......38...........6....7423"
    $s &= ",..........5724...98....947...9..3...5..9..12...3.1.9...6....25....56.....7......6"
    $s &= ",....75....1..2.....4...3...5.....3.2...8...1.......6.....1..48.2........7........"
    $s &= ",6.....7.3.4.8.................5.4.8.7..2.....1.3.......2.....5.....7.9......1...."
    $s &= ",....6...4..6.3....1..4..5.77.....8.5...8.....6.8....9...2.9....4....32....97..1.."
    $s &= ",.32.....58..3.....9.428...1...4...39...6...5.....1.....2...67.8.....4....95....6."
    $s &= ",...5.3.......6.7..5.8....1636..2.......4.1.......3...567....2.8..4.7.......2..5.."
    $s &= ",.5.3.7.4.1.........3.......5.8.3.61....8..5.9.6..1........4...6...6927....2...9.."
    $s &= ",..5..8..18......9.......78....4.....64....9......53..2.6.........138..5....9.714."
    $s &= ",..........72.6.1....51...82.8...13..4.........37.9..1.....238..5.4..9.........79."
    $s &= ",...658.....4......12............96.7...3..5....2.8...3..19..8..3.6.....4....473.."
    $s &= ",.2.3.......6..8.9.83.5........2...8.7.9..5........6..4.......1...1...4.22..7..8.9"
    $s &= ",.5..9....1.....6.....3.8.....8.4...9514.......3....2..........4.8...6..77..15..6."
    $s &= ",.....2.......7...17..3...9.8..7......2.89.6...13..6....9..5.824.....891.........."
    $s &= ",3...8.......7....51..............36...2..4....7...........6.13..452...........8.."

    Local $a = StringSplit($s, ",")
    Local $n, $b[UBound($a) - 2][2]
    For $n = 0 To UBound($a) - 3
        $b[$n][0] = "From TOP 95: # " & $n + 1
        $b[$n][1] = $a[$n + 2]
    Next
    $aSudokus = $b
EndFunc   ;==>GenArray

 

then again, one runs in AutoIt and the other in sqlite. So is not Apples to Apples.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

23 hours ago, Chimp said:

the puzzle included in the listing has only one solution

".....7.9..3..2...8..96..5....53..9...1..8...26....4...3......1..4......7..7...3.." ; 155 results in 10 sec.
"37...8........32..1......6..9.12.5....4...1....1.37.2..2......9..69........2...18" ; 17 results in 3 sec.

:) 

Edited by argumentum
added 1 more

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

40 minutes ago, argumentum said:

".....7.9..3..2...8..96..5....53..9...1..8...26....4...3......1..4......7..7...3.." ; 155 results in 10 sec.
"37...8........32..1......6..9.12.5....4...1....1.37.2..2......9..69........2...18" ; 17 results in 3 sec.

:) 

(?) what code are you using to get that output and those (wrong?) results?

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

3 minutes ago, Chimp said:

what code are you using to get that output and those (wrong?) results?

the code you used from sqlite site. The string of sudoku is a mod. of exiting strings.
Why so you find the strings to be wrong?
 

Spoiler

 

Global $so

$so = "53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79" ; 1 result in 0.300 sec.
$so = ".61..7..3.92..3..............853..........5.45....8....4......1...16.8..6........" ; 1 result in 421 sec
$so = ".....7.9..3..2...8..96..5....53..9...1..8...26....4...3......1..4......7..7...3.." ; 155 results in 10 sec.
$so = "37...8........32..1......6..9.12.5....4...1....1.37.2..2......9..69........2...18" ; 17 results in 3 sec.


#include <SQLite.au3>
#include <array.au3>
Local $hDB, $aRows, $iRows, $iCols
_SQLite_Startup(".\sqlite3.dll")
$hDB = _SQLite_Open()
Local $sSudoku_sql = "WITH RECURSIVE" & _
        "  input(sud) AS (" & _
        "    VALUES('"& $so &"')" & _
        "  )," & _
        "  digits(z, lp) AS (" & _
        "    VALUES('1', 1)" & _
        "    UNION ALL SELECT" & _
        "    CAST(lp+1 AS TEXT), lp+1 FROM digits WHERE lp<9" & _
        "  )," & _
        "  x(s, ind) AS (" & _
        "    SELECT sud, instr(sud, '.') FROM input" & _
        "    UNION ALL" & _
        "    SELECT" & _
        "      substr(s, 1, ind-1) || z || substr(s, ind+1)," & _
        "      instr( substr(s, 1, ind-1) || z || substr(s, ind+1), '.' )" & _
        "     FROM x, digits AS z" & _
        "    WHERE ind>0" & _
        "      AND NOT EXISTS (" & _
        "            SELECT 1" & _
        "              FROM digits AS lp" & _
        "             WHERE z.z = substr(s, ((ind-1)/9)*9 + lp, 1)" & _
        "                OR z.z = substr(s, ((ind-1)%9) + (lp-1)*9 + 1, 1)" & _
        "                OR z.z = substr(s, (((ind-1)/3) % 3) * 3" & _
        "                        + ((ind-1)/27) * 27 + lp" & _
        "                        + ((lp-1) / 3) * 6, 1)" & _
        "         )" & _
        "  )" & _
        "SELECT s FROM x WHERE ind=0;"
Global $tTimer = TimerInit()
_SQLite_GetTable($hDB, $sSudoku_sql, $aRows, $iRows, $iCols)
ConsoleWrite( Round(TimerDiff($tTimer) / 1000, 3) & " sec." & @CRLF)
_ArrayDisplay($aRows,  "Solved in " & Round(TimerDiff($tTimer) / 1000, 3) & " sec.")

 

 

Edited by argumentum
added the code

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

... from my run I get this, 3 solutions for first puzzle and also 3 solutions for the second. What me (or you) are doing wrong?

.....7.9..3..2...8..96..5....53..9...1..8...26....4...3......1..4......7..7...3..
162857493534129678789643521475312986913586742628794135356478219241935867897261354
251847693436925178789613524825371946914586732673294851362758419548139267197462385
251847693436925178789613524825371946914586732673294851392768415548139267167452389


37...8........32..1......6..9.12.5....4...1....1.37.2..2......9..69........2...18
372568491689413275145792863798124536234659187561837924427381659816975342953246718
372568491689413275145792863897124536234659187561837924428371659716985342953246718
372568491968413275145792863793124586284659137651837924427381659816975342539246718

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

12 minutes ago, Chimp said:

what me (or you) are doing wrong?

no clue, I've added the code I'm using to my post above.
 

37...8........32..1......6..9.12.5....4...1....1.37.2..2......9..69........2...18
372568491689413275145792863798124536234659187561837924427381659816975342953246718
372568491689413275145792863897124536234659187561837924428371659716985342953246718
372568491968413275145792863793124586284659137651837924427381659816975342539246718
372618495568493271149752863793124586254869137681537924427381659816975342935246718
372618495568493271149752863793124586284569137651837924427381659816975342935246718
372618495648593271159742863793126584264859137581437926427381659816975342935264718
372618495658493271149752863793124586284569137561837924427381659816975342935246718
372618495685493271149752863798124536234569187561837924427381659816975342953246718
372618495685493271149752863897124536234569187561837924428371659716985342953246718
372618495689453271145792863798124536234569187561837924427381659816975342953246718
372618495689453271145792863897124536234569187561837924428371659716985342953246718
372618495968453271145792863793124586254869137681537924427381659816975342539246718
372618495968453271145792863793124586284569137651837924427381659816975342539246718
372658491689413275145792863798124536234569187561837924427381659816975342953246718
372658491689413275145792863897124536234569187561837924428371659716985342953246718
372658491968413275145792863793124586254869137681537924427381659816975342539246718
372658491968413275145792863793124586284569137651837924427381659816975342539246718

PS: added my array above
PS2: using _SQLite_LibVersion = 3.20.0

PS3: the ".....7.9..3..2...8..96..5....53..9...1..8...26....4...3......1..4......7..7...3.." result is below:

Spoiler
.....7.9..3..2...8..96..5....53..9...1..8...26....4...3......1..4......7..7...3..
162857493534129678789643521475312986913586742628794135356478219241935867897261354
251847693436925178789613524825371946914586732673294851362758419548139267197462385
251847693436925178789613524825371946914586732673294851392768415548139267167452389
254837196136529478789641523875312964413986752692754831368475219541293687927168345
254837196136529478879641523785312964413986752692754831368475219541293687927168345
256837194134529768879641523485312976713986452692754831368475219541293687927168345
256847193134529768879631524485312976713986452692754831368475219541293687927168345
256847193431925678789613524825371946914586732673294851362758419548139267197462385
256847193431925678789613524825371946914586732673294851392768415548139267167452389
258137496436529178179648523725361984914785632683294751392476815841953267567812349
258437196136529748479618523825361974714985632693274851382756419541893267967142385
258437196136529748479618523825361974714985632693274851382796415941853267567142389
258437196136925748479618523825361974714589632693274851382756419541893267967142385
258437196136925748479618523825361974714589632693274851382796415941853267567142389
261857493534129678789643521425371986913586742678294135392765814146938257857412369
261857493534129678789643521475312986913586742628794135356478219142935867897261354
264857193531429678789631524875362941413985762692714835358276419146593287927148356
264857193531429678879631524425376981713985462698214735356748219942163857187592346
264857193531429678879631524785362941413985762692714835358276419146593287927148356
264857193531429768789631524875362941413985672692714835358276419146593287927148356
264857193531429768879631524485362971713985642692714835358276419146593287927148356
264857193531429768879631524785362941413985672692714835358276419146593287927148356
268157493531429678479638521785312946914586732623794185396875214142963857857241369
268157493531429678479638521785312946914586732623974185392765814146893257857241369
268157493531429678479638521785312964914586732623974185392745816146893257857261349
268157493531429768479638521825361974714985632693274185352746819146893257987512346
268157493531429768479638521825361974714985632693274185352746819946813257187592346
268517493531429768479638521825361974714985632693274185352746819146893257987152346
268537194531429768479618523785362941914785632623194875352876419146953287897241356
268537491531429768479618523825361974714985632693274185352746819146893257987152346
286457193534921678179638524425376981713589462698214735362745819941863257857192346
426857193531429768879631524285376941714985632693214875352798416948163257167542389
462857193531429678789613524825371946914586732673294851358762419146935287297148365
462857193531429678789613524825371946914586732673294851398762415146935287257148369
462857193531429768789613524875362941914785632623194875356278419148936257297541386
462857193531429768789613524875362941914785632623194875358276419146938257297541386
462857193531429768789631524875362941914785632623914875358276419146593287297148356
462857193531429768879613524785362941914785632623194875356278419148936257297541386
462857193531429768879613524785362941914785632623194875358276419146938257297541386
462857193531429768879631524285376941714985632693214875358762419146593287927148356
462857193531429768879631524785362941914785632623914875358276419146593287297148356
468157293531429768279638541725316984914785632683294175356872419142963857897541326
468157293531429768729638541275316984914785632683294175356872419142963857897541326
468157293531429768729638541285316974914785632673294185356872419142963857897541326
468517293531429768279638541725361984914785632683294175352876419146953827897142356
468517293531429768729638541275361984914785632683294175352876419146953827897142356
468517293531429768729638541285361974914785632673294185352876419146953827897142356
468537291531429768279618543725361984914785632683294175352876419146953827897142356
468537291531429768729618543275361984914785632683294175352876419146953827897142356
468537291531429768729618543285361974914785632673294185352876419146953827897142356
482537196536129748179648523825316974714985632693274851358762419941853267267491385
482537196536129748179648523825316974714985632693274851368792415941853267257461389
482537196536129748179648523825361974714985632693274851368792415941853267257416389
524837196136529478789641523875362941413985762692174835358796214941253687267418359
524837196136529478789641523875362941413985762692714835358476219941253687267198354
524837196136529478879641523785362941413985762692174835358796214941253687267418359
524837196136529478879641523785362941413985762692714835358476219941253687267198354
524837196136529748879641523485362971713985462692174835358796214941253687267418359
524837196136529748879641523485362971713985462692714835358476219941253687267198354
524837196136925478789641523875362941413589762692174835358796214941253687267418359
524837196136925478789641523875362941413589762692714835358476219941253687267198354
524837196136925478879641523785362941413589762692174835358796214941253687267418359
524837196136925478879641523785362941413589762692714835358476219941253687267198354
524837196136925748879641523485362971713589462692174835358796214941253687267418359
524837196136925748879641523485362971713589462692714835358476219941253687267198354
526837194431529768879641523285376941714985632693214875352798416948163257167452389
526837194431529768879641523285376941714985632693214875362758419948163257157492386
526837194431925768879641523285376941714589632693214875352798416948163257167452389
526837194431925768879641523285376941714589632693214875362758419948163257157492386
526847193431529768879631524285376941714985632693214875352798416948163257167452389
526847193431529768879631524285376941714985632693214875362758419948163257157492386
526847193431925768879631524285376941714589632693214875352798416948163257167452389
526847193431925768879631524285376941714589632693214875362758419948163257157492386
561837294734529168829641573475362981913785642682194735358276419146953827297418356
561837294734529168829641573475362981913785642682194735358276419246913857197458326
561837294734529168829641573475362981913785642682914735358276419246193857197458326
561847293734529168289613574475362981913785642628194735356278419142936857897451326
561847293734529168829613574475362981913785642682194735358276419246931857197458326
561847293734529168829631574475362981913785642682194735358276419146953827297418356
561847293734529168829631574475362981913785642682194735358276419246913857197458326
561847293734529168829631574475362981913785642682914735358276419246193857197458326
562817493431529768789643521825361974914785632673294185356472819148936257297158346
562817493431529768789643521825361974914785632673294185358476219146932857297158346
562817493431529768879643521725361984914785632683294175356472819148936257297158346
562817493431529768879643521725361984914785632683294175358476219146932857297158346
562837194431529768789641523875362941914785632623194875358276419146953287297418356
562837194431529768879641523285376941714985632693214875326758419948163257157492386
562837194431529768879641523285376941714985632693214875358762419946153287127498356
562837194431529768879641523285376941714985632693214875358792416946153287127468359
562837194431529768879641523785362941914785632623194875358276419146953287297418356
562837194431925768879641523285376941714589632693214875326758419948163257157492386
562837194431925768879641523285376941714589632693214875358762419946153287127498356
562837194431925768879641523285376941714589632693214875358792416946153287127468359
562837491431529768789641523825316974914785632673294185356472819148963257297158346
562837491431529768879641523725316984914785632683294175356472819148963257297158346
562847193134529678789613524475362981913785462628194735356478219241936857897251346
562847193431529768789613524875362941914785632623194875356278419148936257297451386
562847193431529768789613524875362941914785632623194875358276419146938257297451386
562847193431529768789631524875362941914785632623194875358276419146953287297418356
562847193431529768879613524785362941914785632623194875356278419148936257297451386
562847193431529768879613524785362941914785632623194875358276419146938257297451386
562847193431529768879631524285376941714985632693214875326758419948163257157492386
562847193431529768879631524285376941714985632693214875358762419946153287127498356
562847193431529768879631524285376941714985632693214875358792416946153287127468359
562847193431529768879631524785362941914785632623194875358276419146953287297418356
562847193431925768879631524285376941714589632693214875326758419948163257157492386
562847193431925768879631524285376941714589632693214875358762419946153287127498356
562847193431925768879631524285376941714589632693214875358792416946153287127468359
564817293731529648829643571275361984413985762698274135352798416946132857187456329
564817293731529648829643571275361984413985762698274135382756419946132857157498326
564817293731529648829643571275361984413985762698274135386752419942136857157498326
564817293731925468289643571425371986913586742678294135396752814842139657157468329
564817293731925648829643571275361984413589762698274135352798416946132857187456329
564817293731925648829643571275361984413589762698274135382756419946132857157498326
564817293731925648829643571275361984413589762698274135386752419942136857157498326
564837291731529648829641573275316984413985762698274135352768419946153827187492356
564837291731529648829641573275316984413985762698274135352798416946153827187462359
564837291731529648829641573275316984413985762698274135386752419942163857157498326
564837291731925648829641573275316984413589762698274135352768419946153827187492356
564837291731925648829641573275316984413589762698274135352798416946153827187462359
564837291731925648829641573275316984413589762698274135386752419942163857157498326
568147293431529768279638541725316984914785632683294175356872419142963857897451326
568147293431529768279638541725361984914785632683294175352876419146953827897412356
568147293431529768729638541275316984914785632683294175356872419142963857897451326
568147293431529768729638541275361984914785632683294175352876419146953827897412356
568147293431529768729638541285316974914785632673294185356872419142963857897451326
568147293431529768729638541285361974914785632673294185352876419146953827897412356
568417293431529768279638541725361984914785632683294175352876419146953827897142356
568417293431529768729638541275361984914785632683294175352876419146953827897142356
568417293431529768729638541285361974914785632673294185352876419146953827897142356
568437291431529768279618543725361984914785632683294175352876419146953827897142356
568437291431529768729618543275361984914785632683294175352876419146953827897142356
568437291431529768729618543285361974914785632673294185352876419146953827897142356
582437196136529748479618523825361974714985632693274851368792415941853267257146389
582437196136925748479618523825361974714589632693274851368792415941853267257146389
824537196536129478179648523785362941413985762692714835358476219241893657967251384
824537196536129478179648523785362941413985762692714835358476219941253687267891354
824537196536129748179648523485362971713985462692714835358476219241893657967251384
824537196536129748179648523485362971713985462692714835358476219941253687267891354
852137496436529178179648523725361984914785632683294751398476215241953867567812349
852437196136529748479618523285361974714985632693274851328756419541893267967142385
852437196136529748479618523285361974714985632693274851328796415941853267567142389
852437196136529748479618523285361974714985632693274851368752419541893267927146385
852437196136529748479618523285361974714985632693274851368792415941853267527146389
852437196136925748479618523285361974714589632693274851328756419541893267967142385
852437196136925748479618523285361974714589632693274851328796415941853267567142389
852437196136925748479618523285361974714589632693274851368752419541893267927146385
852437196136925748479618523285361974714589632693274851368792415941853267527146389
856437291134529768279618534425371986713986452698254173362745819541893627987162345
862157493531429678479638521785312946914586732623794185396275814148963257257841369
862157493531429678479638521785312946914586732623974185398765214146293857257841369
862157493531429678479638521785312964914586732623974185398745216146293857257861349
862457193534129678179638524425376981713985462698214735356742819941863257287591346
862457193534921678179638524425376981713589462698214735356742819941863257287195346
862537194531429768479618523785362941914785632623194875358276419146953287297841356

 

PS4: I just read your post below. 
this happens to the best of us ;) 

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

Sorry, but you're right!
doing some previous tests I modified and saved the query by inserting the clause "LIMIT 3;" at the end of the query, then I forgot about this change I had made and continued to use the modified query getting results limited to 3.
my fault! sorry.

P.S.....I'm getting old :(

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Yeah, the subquery flattener of the query planner/optimizer isn't always smart enough to perform such (advanced?) optimization, mainly because there are potential dark corners where a seemingly clever optimization falls flat on its nose in another seemingly similar use case.

Such remarks regularly pop up on the mailing list, but often enough, the proposed optimization made by people would work on their precise test case but have devastating effects on another large range of slightly different queries.

SQLite main use base (in terms of number of devices) is for low-end devices having limited computing power and/or memory. So contrary to Oracle or MySQL and other RDBMS where massaging a query ad nauseam to choose the absolute best plan is both possible and beneficial, SQLite can't devote as much code and complexity.

In case one of your queries takes longer than expected, try looking at what EXPLAIN QUERY PLAN <query> yields. The output often calls for a rewrite of the query and/or creation of a useful index. See http://www.sqlite.org/eqp.html

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...