What is wrong with my logic?

Programs which generate, solve, and analyze Sudoku puzzles

What is wrong with my logic?

Postby funkybeatz » Thu Jul 21, 2005 11:05 am

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!:D
funkybeatz
 
Posts: 1
Joined: 21 July 2005

Postby simes » Thu Jul 21, 2005 11:22 am

Nothing is wrong, but you need to try some harder puzzles. This simple logic is all that is needed for the simpler puzzles.
Last edited by simes on Sun Dec 11, 2011 9:32 am, edited 1 time in total.
simes
 
Posts: 324
Joined: 11 March 2005
Location: UK

Re: What is wrong with my logic?

Postby dukuso » Fri Jul 22, 2005 6:33 am

> I ended up with 40 lines ( including generation of UI ) and it seems to >work on every 'simple' sodoku i've tested.

what's UI ?
what language ?
can you post the 40 lines ?
how fast is it ?
dukuso
 
Posts: 479
Joined: 25 June 2005


Return to Software

cron