No sudoku examples, sorry -- and the existing examples are probably
more help if you want to /solve/ sukodus.
I haven't ever really thought about what kind of decisions are
involved in generating a sudoku board, so I can't bang out a sketch
either. (I'm not even sure if Screamer is a good match for the
problem, actually. It's definitely a good match for /solving/ a board,
but less sure about generating one.)
Cheers.
-- nikodemus
just to add my two cents: as far as I know there is no structural approach
to generate Sudoku puzzles. Maybe the following is a viable way:
- start with a fully filled board and randomly shuffle the columns and rows
- now randomly remove some numbers
- check that the resulting problem is still a Sudoku, i.e. it has a unique
solution
- start again and maybe remove some more values
Since in the last step you may search over a very huge search space you
wan to
- set a time limit for the solving process
- maybe limit the number of fails to avoid creating overly difficult
problems.
With the provided Sudoku solver example I _think_ you can realize the
above approach without much difficulty (talk is cheap, I know). Though, I
don't know off hand whether Screamer allows for a time based search limit.
Best regards,
Stephan
1. randomly select a row or column and shuffle the three rows/columns of
its Sub-Block
2. goto 1. until you think it's been enough shuffling
3. proceed with the steps below
Sorry, I meant Gecode library.
Hi Haris,
I have the feeling that we are misunderstanding each other. What I
described was a solution for creating Sudoku puzzles with the help of
the already existing constraint solving based solver which checks that
you didn't remove too many fields such that there is more than one solution.
I know of no other way where constraints would be of further help when
one is _generating_ Sudoku puzzles other than checking that there is a
unique solution.
Could you point me to the Ruby could you mentioned?
Kind regards,
Stephan
http://gecoder.rubyforge.org/examples/sudoku.html
I don't really know much about constraint programming,
is that just the way I create an algorithm
or I need some library for that ?
Hi Haris,
this is a Sudoku solver, not a Sudoku problem generator.
But I have to apologize: some time ago I discussed some additional
Screamer examples with Nikodemus and one such example included a Sudoku
solver. Somehow this hasn't made it into the repository yet, so my
reference to the examples directory was misleading. Please find attached
the example which should run with the Screamer code of the dev branch
from github.
Best regards and sorry for the confusion,
Stephan
> solver. Somehow this hasn't made it into the repository yet, so my
> reference to the examples directory was misleading. Please find attached
> the example which should run with the Screamer code of the dev branch
> from github.
This totally fell off my map. I'll try to see to it this week.
Many thanks for the example!
Cheers,
-- nikodemus
>> solver. Somehow this hasn't made it into the repository yet, so my
>> reference to the examples directory was misleading. Please find attached
>> the example which should run with the Screamer code of the dev branch
>> from github.
>
> This totally fell off my map. I'll try to see to it this week.
Now in documentation.
Apropos: I added a branch "wip" which has cleaner history than "dev",
and should be functionally equivalent -- but unlike "dev" it will be
rebased periodically.
Once the batting list for 3.21 is complete, "master" will become
"classic" and "wip" will become "master", and "dev"... will be
forgotten. (So "dev" is just a convenience for now to make pulling it
easy.)
Cheers,
-- nikodemus