Sudoku creator

So I want to program Sudoku, but before I got to the programming, I realized that I didn't know how to make the original board. Sure, I could make my program start with a full board and hide some numbers, but I wouldn't know if it was solvable or not anymore. Is there a simple way to make a solvable beginning?

Re: Sudoku creator

That must be easy, though I confess I didn't try.
There are only four kinds of configuration for a board: illegal, solved (=legal and full), with one solution and with many solutions. I guess that you are interested in the kind with one solution and a minimal number of numbers already filled in.
To recognize illegal and full must be trivial. To find one solution you use the algorithm of JosAH's blog on this forum:http://www.java-forums.org/blogs/josah/75-sudoku.html, and if you use more iterations until you find another solution it is in the many solutions category and so again you are not interested.
So just write a genetic algorithm and reward one-solution solutions with a minimal filled-in-number-count and presto!

Re: Sudoku creator

Is there a simple way to make a solvable beginning?

I think I read somewhere that this is an NP-Hard problem, so, I don't think so.

When I implemented one years back, I started with solved puzzles and then removed some random set of values. I had to test after each removal though, to ensure I didn't make the puzzle unsolvable. It was very iterative and guess & check, but computers are fast and great at this kind of thing. Puzzle generation still only took milliseconds.

Re: Sudoku creator

Thanks for the answers! It seems like you either solve it using the given formula or use guess and check. I won't use the formula until I fully understand it(I just skimmed through it) and guess and check isn't really my style. I think I'll first make an AI for Tic-Tac-Toe, and come back to this tomorrow with a fresh mind. Again, thanks for the quick answers.

Re: Sudoku creator

Originally Posted by bob 6

Thanks for the answers! It seems like you either solve it using the given formula or use guess and check. I won't use the formula until I fully understand it(I just skimmed through it) and guess and check isn't really my style. I think I'll first make an AI for Tic-Tac-Toe, and come back to this tomorrow with a fresh mind. Again, thanks for the quick answers.