Hi, I discovered sudoku yesterday! I decided to write a brute force app to solve sudoku using as few lines of vb.net code as possible. I ended up with 40 lines ( including generation of UI ) and it seems to work on every 'simple' sodoku i've tested.
There seems to be lots of intelligent people on this board, discussing many advanced ways of cracking the problem. My logic seems very lightweight in comparison. What am I missing?
1) Count number of blank positions
2) Fill every blank position with 'possibilities' :123456789
3) For each position:
scan rows. if a number exists elsewhere on that row, remove from 'possibilities' for that position
scan columns.if a number exists elsewhere on that column, remove from 'possibilities' for that position
scan boxes.if a number exists elsewhere on that box, remove from 'possibilities' for that position
if number of possibilities for that position=1 it must be the correct result so fill that position.
4) if number of blank positions remaining>0 then move to next position and repeat at step 2.
Its worked every time, but my logic cant be right otherwise you lot would have sussed this ages ago!!
whats wrong!