Sudoku Question

WebKill

Member
Joined
Apr 7, 2008
Messages
12
Programming Experience
Beginner
I'm making a Sudoku game and am trying to figure out how to best generate the puzzle board. I came across a thread when I searched here that talked about an idea I had, which is to randomly generating numbers in all 81 boxes while making sure the same number is not in the same row/column. This would net a complete board, then you simply take out so many numbers and there you have it.

My question is, if you use this method, how do you get boards of varying difficulty? I was reading online that the amount of numbers does not contribute to the difficulty of the board (something I noticed while playing them on paper), but rather the logic it takes and how many moves ahead you have to think in order to get a number.

While searching online for some clues on how to start this, I came across this website: davidbau.com: Sudoku Generator

It is a python script that generates a sudoku board of random difficulty based on the logic needed to solve it. This would be great if I knew python scripting and could convert to vb.net.

Any ideas to get me started? Thanks!
 
Thanks for the reading material suggestion, but I'm going to work on this myself for a while before I think about going there.

So far I have gotten it randomly generating a number 1-9 through a function I wrote that excludes all numbers within it's 3x3 box, all numbers in it's row, and all numbers in it's column. All the numbers are placed into a 2d array.

The problem I now face is that there are inevitably 5 or 6 spaces that nothing can go into because the only number left for that 3x3 area is in the same row or column already, therefore there are no numbers left for it to try. I think I read something about this while i was researching, I think it was called backtracing, but I'm not sure.

I've probably been working on this for too long today and need to take a break, but I thought I would see if anyone could provide me with guidance on what to do next; I am enjoying figuring this out as I am learning as I do it!
 
Back
Top