Need help creating a program to create suduko  
Author Message
Jared77





PostPosted: 2006-4-7 22:38:00 Top

java-programmer, Need help creating a program to create suduko Still a little rough at this language but i need to create a program
for my class. Was wanting to create a java program that makes sudukos.
It doesn't need a GUI or anything like that just ouput to a txt file
ot to the screen. I would appreciate any help or direction.

 
Rhino





PostPosted: 2006-4-7 22:48:00 Top

java-programmer >> Need help creating a program to create suduko
"Jared77" <email***@***.com> wrote in message
news:email***@***.com...
> Still a little rough at this language but i need to create a program
> for my class. Was wanting to create a java program that makes sudukos.
> It doesn't need a GUI or anything like that just ouput to a txt file
> ot to the screen. I would appreciate any help or direction.
>
It seems to me that you need to figure out what algorithm to use before you
worry about exactly how to code the statements. Basically, you need to
figure out how a Sudoku gets constructed well enough that you can describe
the process in English first. I don't mean that you need to know the rules
for how to _solve_ a Sudoku: I'm talking about the techniques needed to
_construct_ a new one from scratch.

If you do a Google search, you should be able to track down some Sudoku
construction algorithms. If that doesn't work, try downloading some of the
free Sudoku builders that come with source code and see if you can reason
out how they are creating their Sudokus. You'll probably find Sudoku
construction programs in a variety of languages.

You can then try translating that language into Java; ask here if you are
having trouble converting particular statements.


 
Oliver Wong





PostPosted: 2006-4-8 1:25:00 Top

java-programmer >> Need help creating a program to create suduko
"Rhino" <email***@***.com> wrote in message
news:NXuZf.3563$email***@***.com...
>
> "Jared77" <email***@***.com> wrote in message
> news:email***@***.com...
>> Still a little rough at this language but i need to create a program
>> for my class. Was wanting to create a java program that makes sudukos.
>> It doesn't need a GUI or anything like that just ouput to a txt file
>> ot to the screen. I would appreciate any help or direction.
>>
> It seems to me that you need to figure out what algorithm to use before
> you worry about exactly how to code the statements. Basically, you need to
> figure out how a Sudoku gets constructed well enough that you can describe
> the process in English first. I don't mean that you need to know the rules
> for how to _solve_ a Sudoku: I'm talking about the techniques needed to
> _construct_ a new one from scratch.
>
> If you do a Google search, you should be able to track down some Sudoku
> construction algorithms. If that doesn't work, try downloading some of the
> free Sudoku builders that come with source code and see if you can reason
> out how they are creating their Sudokus. You'll probably find Sudoku
> construction programs in a variety of languages.

Actually, making Sudoku doesn't seem to be that easy (to me at least),
so unless the OP really loves Sudoku (which I'm a bit skeptical about since
(s)he misspelled its name), or has a strong background in math, logic and/or
abstract thinking, perhaps (s)he should tackle a different project;
especially if at the same time (s)he's going to be struggling with learning
Java itself.

If you want to give it a shot anyway, there was this guide written by a
Japanese person called "Let's Make Sudoku". The site is gone now, but there
seems to be a mirror (a plagiarism?) of it at this other site:
http://www.hanspeter.dk/Sudoku/sudoku01.html

The instructions on how to make a sudoku are 10 pages long, and it
always places the givens in the same locations in the grid. Like I said, not
very easy. The trick they use also assumes you're a flawless Sudoku solver,
as the process is basically to place some givens, then try to solve as much
as possible, then place some more givens, then try to solve as much as
possible, and repeat ad nauseum.

- Oliver

 
 
Patricia Shanahan





PostPosted: 2006-4-8 2:36:00 Top

java-programmer >> Need help creating a program to create suduko Oliver Wong wrote:
...
> Actually, making Sudoku doesn't seem to be that easy (to me at
> least), so unless the OP really loves Sudoku (which I'm a bit skeptical
> about since (s)he misspelled its name), or has a strong background in
> math, logic and/or abstract thinking, perhaps (s)he should tackle a
> different project; especially if at the same time (s)he's going to be
> struggling with learning Java itself.
>
> If you want to give it a shot anyway, there was this guide written by
> a Japanese person called "Let's Make Sudoku". The site is gone now, but
> there seems to be a mirror (a plagiarism?) of it at this other site:
> http://www.hanspeter.dk/Sudoku/sudoku01.html
>
> The instructions on how to make a sudoku are 10 pages long, and it
> always places the givens in the same locations in the grid. Like I said,
> not very easy. The trick they use also assumes you're a flawless Sudoku
> solver, as the process is basically to place some givens, then try to
> solve as much as possible, then place some more givens, then try to
> solve as much as possible, and repeat ad nauseum.
>
> - Oliver

I would not go at it that way round. Generally, filling in the blanks is
a bad way to build random permutations, and soduko board-building looks
to me very like a random permutation problem.

Instead, I would start from any known legal result, but presumably a
very simple, regular one. Design soduko-preserving transformations, and
apply randomly chosen transformations. See how array shuffling is done
for a simpler version.

Finally, erase most of the data.

Patricia
 
 
Ernie Wright





PostPosted: 2006-4-8 3:45:00 Top

java-programmer >> Need help creating a program to create suduko Patricia Shanahan wrote:

> Instead, I would start from any known legal result, but presumably a
> very simple, regular one. Design soduko-preserving transformations, and
> apply randomly chosen transformations. See how array shuffling is done
> for a simpler version.
>
> Finally, erase most of the data.

Although appealing, this has a couple of problems. Sudoku-preserving
transformations, other than trivial ones relying on symmetry, may be
difficult to devise (I don't know). A problem I'm certain about is
that you can't simply erase most of the digits. A contraint on the
remaining digits is that they must lead to a unique solution, and in
general, erasing random digits won't ensure this.

- Ernie http://home.comcast.net/~erniew