SudokuSolver Forum

A forum for Sudoku enthusiasts to share puzzles, techniques and software
It is currently Fri Apr 19, 2024 10:30 pm

All times are UTC




Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Tue May 27, 2008 7:00 pm 
Offline
Grand Master
Grand Master
User avatar

Joined: Mon Apr 21, 2008 10:32 am
Posts: 868
nj3h wrote:
One of the things that I like about SudoCue and Sadman's Sudoku is the ability to select techniques to be considered for a puzzle. Just because you select X-Wing or Empty Rectangle doesn't mean a particular puzzle will have that technique, but it could. It sure as heck won't have skyscrapers, kites, stuvwxyz-wings or whatever.
AFAIK SudoCue does not allow you to select techniques, only a difficulty. SadMan allows you to select both allowed and required techniques, but sometimes takes very long to generate a puzzle fitting a specific set of selections ... because AFAIK SadMan uses brute force to find a suitable puzzle and no logic. Using logic to create a puzzle having a set of specific techniques, would surely be a challenge, but probably take a lot of time to figure out, if at all possible. I think that also Ruud used brute force to create suitable puzzles for the competitions. If you mass create enough puzzles, the probability of getting some suitable ones should increase. My guess is that if Ruud is able to generate techniques at will, he would have made a deluxe version of SudoCue capable of this and sold it for good money.

What is wrong about Skyscrapers and 2-String Kites? They are a generalized X-Wing and fun to find and solve.

nj3h wrote:
I guess the generation of Samurai puzzles within a set of possible techniques must be more difficult than I am capable of understanding. However, I hope that this is ultimate goal of any generator program.
If it was easy it would probably be several programs (free or for sale) around doing this. The few people that are good at this (Ruud, D.J. Ape and others) keep their secrets to them self.
Ever looked at SUDOKU MENTOR? From the description it looks good and you can try it free for 15 days. If you try it, an evaluation report would be much appreciated.

nj3h wrote:
But does one really need a Cray to do this within a reasonable period of time?
Absolutely not. Eventually both JSudoku and SudokuSolver will likely offer what you want. It is just an a lot of work to program it, so please be patient. I generated my very first Sudoku on Wednesday March 12, 2008, 11 weeks ago, and I like to think that I have made quite some progress since then.

_________________
Quis custodiet ipsos custodes?
Normal: [D  Y-m-d,  G:i]     PM->email: [D, d M Y H:i:s]


Top
 Profile  
Reply with quote  
PostPosted: Tue May 27, 2008 7:14 pm 
Offline
Grand Master
Grand Master
User avatar

Joined: Mon Apr 21, 2008 10:32 am
Posts: 868
nj3h wrote:
I hope that eventually Borge’s program will function for the different types of overlapping puzzles in JSudoku. I enjoy the overlapping puzzles very much.
I am programming general algorithms for everything, so when I am finished adding a couple of puzzle types should be "a piece of cake". At the end of the post the complete code that is specific to a Samurai.

nj3h wrote:
I will sit back and wait for the assembled team out there to do their thing.
But PLEASE be VERY patient.

Code:
Option Explicit   'SHEET Samurai


Public Sub InitializeSudokus9x9(Optional ByVal dummy_to_prevent_this_sub_from_beeing_listed_in_Tools_Macro_Macros As Boolean = True)

    Application.EnableCancelKey = xlDisabled
    num_sudokus_9x9 = 5
    preferred_clues_in_regular_nonets_excluding_clueless_cells = 3
    sudoku_cells_columns = 23
    sudoku_cells_rows = 23
    Call Initialize9x9Grids

    Set p_sudokus_9x9(1).grid = Range("B2").Resize(9, 9)
    p_sudokus_9x9(1).index_background_colour = index_colour_grid_background_1

    Set p_sudokus_9x9(2).grid = p_sudokus_9x9(1).grid.Offset(RowOffset:=0, ColumnOffset:=12)
    p_sudokus_9x9(2).index_background_colour = index_colour_grid_background_1

    Set p_sudokus_9x9(3).grid = p_sudokus_9x9(1).grid.Offset(RowOffset:=6, ColumnOffset:=6)
    p_sudokus_9x9(3).index_background_colour = index_colour_grid_background_2
    p_sudokus_9x9(3).has_overlapping_nonets_and_one_grid_wide_colour = True

    Set p_sudokus_9x9(4).grid = p_sudokus_9x9(1).grid.Offset(RowOffset:=12, ColumnOffset:=0)
    p_sudokus_9x9(4).index_background_colour = index_colour_grid_background_1

    Set p_sudokus_9x9(5).grid = p_sudokus_9x9(2).grid.Offset(RowOffset:=12, ColumnOffset:=0)
    p_sudokus_9x9(5).index_background_colour = index_colour_grid_background_1

    Call InitializeSudokuCells
End Sub

_________________
Quis custodiet ipsos custodes?
Normal: [D  Y-m-d,  G:i]     PM->email: [D, d M Y H:i:s]


Top
 Profile  
Reply with quote  
PostPosted: Wed May 28, 2008 1:34 pm 
Offline
Addict
Addict

Joined: Mon Apr 21, 2008 4:42 pm
Posts: 39
Location: Montesson
Børge wrote:
nj3h wrote:
.... It sure as heck won't have skyscrapers, kites, stuvwxyz-wings or whatever.
...
What is wrong about Skyscrapers and 2-String Kites? They are a generalized X-Wing and fun to find and solve.
I agree with Børge, after looking for X-wings, the next use for filters I apply is to look for couple of cells which can turn out to be Skyscrapers or 2-String Kites. :whistle:
Børge wrote:
I generated my very first Sudoku on Wednesday March 12, 2008, 11 weeks ago, and I like to think that I have made quite some progress since then.

Quite impresive! :applause:
I appreciate what Børge has done to keep the supply of Sudokus, not only in quantity but mainly on very good quality (quality > customer expectations), and kept the comunity on the good tracks. :D

_________________
Nothing can both be and not be


Top
 Profile  
Reply with quote  
PostPosted: Wed May 28, 2008 8:54 pm 
Offline
Expert
Expert

Joined: Tue Apr 22, 2008 2:07 am
Posts: 107
There is nothing wrong with some of these other techniques. However, when solving on paper, without some of the helper software, it is nice not to have too many upper lever techniques to worry about.


Top
 Profile  
Reply with quote  
PostPosted: Fri May 30, 2008 5:58 pm 
Offline
Site Admin

Joined: Sun Apr 13, 2008 1:50 pm
Posts: 191
Location: London
nj3h wrote:
It is obvious the JC, RB, and Borge are doing a tremendous amout of work for the Sudoku community.

I was hoping my initial message might have caused them to comment.
I couldn't respond because I was sitting under a palm tree in the Canary Islands for the last 10 days . . . :oops: Not quite that colour, thanks to SPF 50 sun cream.

I took a blank pad and some pens and noted down a few ideas for puzzle generation and other things to include in SudokuSolver. I am totally novice when it comes to the best trechniques for creating puzzles - but if I can collect some more ideas together, perhaps I can make some progress in providing some tools to help puzzle creation to custom levels of difficulty.

It's definitely on my "to-do" list - but haven't got around to it yet. I'm still testing latest additions to SudokuSolver for Windoku and Non-Consecutive variants.

Rgds
Richard


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 02, 2008 7:51 pm 
Offline
Expert
Expert

Joined: Sun Apr 27, 2008 10:44 am
Posts: 102
Location: Belgium
nj3h wrote:
One of the things that I like about SudoCue and Sadman's Sudoku is the ability to select techniques to be considered for a puzzle. Just because you select X-Wing or Empty Rectangle doesn't mean a particular puzzle will have that technique, but it could. It sure as heck won't have skyscrapers, kites, stuvwxyz-wings or whatever.

I guess the generation of Samurai puzzles within a set of possible techniques must be more difficult than I am capable of understanding. However, I hope that this is ultimate goal of any generator program.


I started to embed logical techniques into the generator in JSudoku.
I started with grids with givens, (vanilla and gattai). I've nothing yet for killer.
See the Samurai I posted here

It wasn't that difficult to implement after all. But I still have quite some work to make it customizable...
Here are some of my notes/ideas related to this topic:

It's rather easy to control the maximum number of times a single technique is used.
But, we should also be able to control the maximum number of times a set of techniques are used. For example: intersections + naked pairs + hidden pairs all together may be used at most N times.

Generating easy to medium puzzle is rather easy, since we need to check only for a limited set of basic techniques, which are fast for a program to check.

As expected, generating hard puzzles is a hard job, because we're looking for puzzles requiring harder techniques, which is more work for a program.
It's even harder if one is looking for a puzzle which requires some specific technique, while excluding others. For example, I tried to generate a Clueless which requires an X-Wing but without turbot, XY-Wings... After an hour or so, it didn't found any puzzle, so I cancelled it.
Here I count the minimum number of times a technique is used. But we should also be able to control the minimum number of times a set of techniques are used. eg there must be at least one of X-Wing or XY-Wing or turbot.

I opted for config files in xml, with some defaults build-in the program. But I still have to desing some UI to let you edit the details, list of techniques with minimum and maximum count, sub-set(s) of techniques with minimum and maximum count...

Not sure this would be sufficient to control the difficulty. I didn't make enough tests yet, but there's probably a good reason why most programs goes through some global rating instead of filtering for particular techniques...

I also found some intersesting ideas in this paper (PDF). In particular the bottleneck idea for the easier puzzles like those published in newspapers.
I played with bottleneck for the very easy puzzles: at each step of the solve path there must be at least N different hidden singles available. Naked singles are not used here, since the idea it to generate a grid solvable with cross hatching only, but no pencil marks.
I currently test only for one solve path. But to be more accurate, one should find the critical solve path, since someone could follow another path which leads to a slimer bottleneck.

We could also add some control over statistical tests for the distibution of techniques. Like median, mean, standard deviation (or variance)...

See also the .scl format used by SudoCue.
BTW can someone explain the difference between "Full House" and "Last Digit"? In the SudoCue solving guide they both refer to the same thing!

I already explained how the generator works in JSudoku. I've "just" added some additional checks using logical techniques while choosing givens.
Since my initial description was unclear, here is an (hopefully) more understandable one:

Every cell is in one of these 3 states: unvisited/untested given, required given or empty/ungiven.
When solving, unvisited or required givens makes no difference, they're just givens/clues.

1. Fill in all cells with a valid solution.
1a. All cells are unvisited givens at first. For overlapping variants, overlapping cells are empty/ungiven if so required.
2. Begin loop to visit all cells at random. For symmetrical puzzles, visiting/choosing a cell also chooses all its symmetrical cell(s). After the visit, the (symmetrical) cell(s) becomes either required given(s) or empty/ungiven cells.
2a. Tag the (symmetrical) cell(s) chosen at 2 as empty/ungiven.
2b. If this leaves too few givens, tag the (symmetrical) cell(s) as required given(s), stop (or continue) the visit loop.
3. Recursively solve the puzzle with all unvisited and required givens as clues. Search for 2 solutions.
3a. My implemetation uses Dancing links (DLX), which makes it easy to count the number of guesses (number of DLX rows - 1) and number of singles (number of DLX columns with 1 DLX row) for each step.
4. If this yields multiple solutions, tag the (symmetrical) cell(s) as required given(s), continue the visit loop.
4a. Dito if this yields too many guesses.
4b. If no guess made at 3a, the grid can be solved with singles only. IWO for each step, DLX found at least one column with a single row.
4c. For the "very easy" difficulty, findout the bottleneck which is the minimum number of singles in the solve path (based on 3a). If too slim/narrow a bottleneck (or used some guess) -> required, next visit.
5. If some guess made at 3a, the grid requires some other technique(s) to solve. But DLX can't tell which particular technique(s) are required. So we need to solve using logical techniques to findout and count the required techniques.
5a. Start to solve using logical techniques among the set of allowed techniques.
5b. If some technique is used more than allowed -> tag as required, next visit (this could be checked within the logical solve loop).
5c. If the grid does not solve using the set of allowed techniques -> tag as required, next visit.
6. Next visit (goto 2.)
7. When all cells have been visited. Final check: discard the grid and re-generate if:
7a. Too many givens
7b. Or too few guesses
7c. Or any required technique was used too few times

Notes: for step 1 I also use DLX, stoping at first solution found. Before DLX starts "solving", all DLX candidate rows are enabled and I shuffle the mandatory DLX columns and the DLX rows within each column. This yields a random valid grid.
For overlapping variants, I now use Børge approach which prove a real time saver, in particular for clueless. It first fills in only the sub-grid with most overlapping cells. This is done by turning the other DLX columns as optional/secondary. They're turned mandatory/primary as soon as the sub-grid gets filled.
For step 2, to avoid clusters of givens, I now use a mix of Børge's and my approaches. It will choose some unvisited cell among those with most number of givens buddies (Børge) + number of adjacent givens (my original approach). There is still a slight tendancy to produce checker patterns, but not as often as before. For diagonal variants, it tends to place very few givens on the diagonals (more buddies), which yields more "interesting" grids.

Comments and ideas welcome.

_________________
Jean-Christophe
"When you have eliminated the impossible, whatever remains, however improbable, must be the truth." Sherlock Holmes.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group