|
Posted by Billy Joe on 10/14/05 23:16
Don M. wrote:
> "Billy Joe" <see.id.line@invalid.org> wrote in message
> news:P6udnd-3ZMngvs3eRVn-3w@adelphia.com...
>>
>> <snip>
>>
>> P.S. any "su doku" fanatics here?
>>
> ===========
>
> Not a fanatic, since they are easy enough not to become an obsession.
> :) There's a website that comes up with random tables, I forgot the
> URL.
>
>
> Don
Well, Don, I only discovered this on the Sunday just passed, when
downloading crosswords from the NY Times - they had a sample. You're right,
not especially challenging, but it was just a sample. Some browsing of the
net shows lots of generators and solvers, amazingly many asking for money
;-0)
Any way, it seemed like more fun to write some code (and who hasn't) to
create puzzles rather than browse around looking for them. As usual.
learned quite a bit about this seemingly simple scheme.
Here's a link http://users.adelphia.net/~bjb1939/Sudoku.zip usual source
code and executable with cursory instructions.
This program is also a random pattern generator.
After generating a puzzle ("New'), press the "Seed" button or select a
different seed/symmetry setting. The lower the seed value, the more likely
a longer solution. As a further hint, the last of the three numbers posted
at the top following "Seed#" is a measure of "difficulty" - being the number
of passes the program needed to solve the puzzle in a simple left-to-right,
top-to-bottom reiterative process of elimination.
The lowest seed value, 24, very often will produce no solvable puzzle/seed
combination in 5,000 variations - after which the program gives up. One can
then try another "New" grid array, or press on in hope that one of the other
95,000 seed patterns will produce a solvable puzzle! (I arbitrarily set the
limits at 100,000 seed patterns across 1,000,000 array patterns).
For those with patience and a reasonable CPU, selecting 24 and pursuing more
than one solvable puzzle might be just the challenge required for that next
trip to the john;-0)
The puzzle can be printed or the user can solve on-screen (in which case a
double-click is required in a box to enable entry). On screen, an erroneous
user entry can be removed by backspacing or deleting the content, or changed
by typing a new value. The program will not allow invalid entries (i.e. if
the number is already in use within the column, row, or 3x3).
The seed can be arranged in full symmetry (US crossword style), half
symmetry (upper left is countered by lower right) or no symmetry.
Regardless of these choices, the difficulty of the solution is somewhat
related to the depth the program found necessary to determine a solution.
I'm unwilling to agree with the math elegance attributed by some to
generating or solving these puzzles, but I will say that the a solution
virtually always involves the program making more than one pass thru the
matrix. At any rate, it's terribly easy to generate random numbers AND
random seed patterns, but somewhat less simple to assure that their
combination into a puzzle can be solved without guesses. Alas, in this case
the user suffers the knowledge that the program solved the puzzle without
ANY guess-work! ;-0)
As "su doku" seems to be a craze in some circles, I thought I'd toss in my
two bits of no fee programming.
Not so off topic, as it's available on WinMX from 3 sources at the moment.
BJ
Navigation:
[Reply to this message]
|