Help With Sudoku Explainer

Interactive on-site game threads go here

Re: Help With Sudoku Explainer

Postby dobrichev » Thu Aug 08, 2019 10:10 pm

Excellent!

I would suggest starting from original code (initial commit) and later apply Sukaku related changes. This would allow some to fork the original (clone the repository) and improve vanilla ignoring sukaku.

My user in github is dobrichev. If it doesn't work, I'll send you my mail address.

A possible workflow is not to give collaborators' any rights. Who wants to contribute can fork, modify, and propose a "merge request" to you, which you can approve by a single click or discard.
dobrichev
2016 Supporter
 
Posts: 1863
Joined: 24 May 2010

Re: Help With Sudoku Explainer

Postby tarek » Thu Aug 08, 2019 11:45 pm

I've added Mladen and uploaded the original SE into the Master branch

I created 2 branches "Serate" and "SukakuExplainer" to play with

I hope this would allow changes to take place to Serate/SukakuExplainer

tarek
User avatar
tarek
 
Posts: 3762
Joined: 05 January 2006

Re: Help With Sudoku Explainer

Postby 1to9only » Fri Aug 09, 2019 10:00 am

Thanks to tarek for getting on the proverbial bike, and stating the SE repository. I had slightly different ideas, voiced here and possibly threading on some toes. So apologies now.

1. In SudokuMonster\SudokuExplainer, place SE (as used by the Patterns Game) and lock the project so it cannot be modified.

2. In SudokuMonster\SukakuExplainer, clone the SE master, and apply the changes to make it SukakuExplainer. It shoud still work with sudokus as per current SE.

There are other SudokuExplainers on GitHub, one implements an 'Undo' in the GUI, another implements 'select one digit and highlight all possible cells' feature (never used either, but I came across them when I was looking for the SE source) - maybe they can be merged into SukakuExplainer.

3. Same for SudokuMonster\Sukaku6(3Cx2R)Explainer. I released a Sudoku6(3Cx2R)Explainer. I think I have a Sukaku6 version which should work for both Sukaku6 and Sudoku6.

4. Same for other SudokuMonster\SEvariants. About the time I was hacking SukakuExplainer and Sudoku6, I also hacked versions of Sudoku16 and SudokuNC - I think they rated some simple puzzles, but I abandoned these projects to do other things.
.
User avatar
1to9only
 
Posts: 4177
Joined: 04 April 2018

Re: Help With Sudoku Explainer

Postby dobrichev » Fri Aug 09, 2019 10:43 am

Hi,

I just applied the updates on "original" 1.2.1 code the serate extension 1.2.1.2. Sources and the binary from gsf (link in the Patterns game).
Release serate 1.2.1.2.

I opened 3 issues for possible initial changes. I can resolve them if you are OK.

I am not sure if locking a project/branch is necessary. Tagging the source + eventual compilation (release) + short list of significant tags/releases (maybe in README.md file) should work too.
dobrichev
2016 Supporter
 
Posts: 1863
Joined: 24 May 2010

Re: Help With Sudoku Explainer

Postby tarek » Fri Aug 09, 2019 7:20 pm

I can see the appeal of having separate projects. This is particularly useful for gsf's serate modification of SE which is being used in the patterns game.

I also like the evolving project from original to searate to sukaku explainer with ability to download each release separately.

I thought that the idea would be to have this repository with many collaborators to improve sukaku explainer. So I'm hoping more collaborators come forward.

Your concise and efficient programming is better than mine so feel free to resolve issues / commit changes.
User avatar
tarek
 
Posts: 3762
Joined: 05 January 2006

Re: Help With Sudoku Explainer

Postby tarek » Sat Aug 10, 2019 9:08 am

dobrichev wrote:I opened 3 issues for possible initial changes. I can resolve them if you are OK.

I looked into the directory structure one and I can see what needs to be done but as I'm not an expert (yet :lol: ) in using the command line prompt / gitbash or similar, then to achieve that possibly needs copying and deleting files. Alternatively deleting the project and re-doing it properly. I'm happy for you to resolve in any way you see fit.

Happy to do either. I can also upload any of 1to9only's work if needed into the repository as separate projects if needed (SE variant, SE 6x6, etc ...)

tarek
User avatar
tarek
 
Posts: 3762
Joined: 05 January 2006

Re: Help With Sudoku Explainer

Postby dobrichev » Sat Aug 10, 2019 10:53 am

As you can see I moved the files and merged serate into master.
Serate extension (so far) doesn't interfere with GUI version, it only adds some functionality.
The same (so far) is true for the pencilmark-only adaptations by 1to9only and a possible next step is applying them to master.

I spent some time in an unsuccessful attempt to rate the chains in parallel.

Possibly the next few steps from me will be
- In master, make the source compilable on my java version and publishing a release (jar + sources version tag)
- In master, apply the changes by 1to9only and publishing the "initial" penclimark-only release.
- branch and do some experiments, committing the changes if some improvement is seen. Later merge to master only after consensus what is worth to go there.

Suggestions for jar files naming convention are welcome.

BTW the term "Sukaku" is misleading due to the strange requirement none of the initial pencilmarks to consist of single possibility (i.e. forbidding vanilla givens). I can't find a reliable source with definition, but even if such exists, I will focus on a variant allowing vanilla givens.
dobrichev
2016 Supporter
 
Posts: 1863
Joined: 24 May 2010

Re: Help With Sudoku Explainer

Postby dobrichev » Sat Aug 10, 2019 12:10 pm

dobrichev
2016 Supporter
 
Posts: 1863
Joined: 24 May 2010

Re: Help With Sudoku Explainer

Postby tarek » Sat Aug 10, 2019 2:36 pm

The debate about what constitutes a sukaku or not is a debate I like to take part in. (But it is a can of worms, who doesn't like worms :lol: )

I (initially) agree that excluding vanilla sudokus from sukakus is silly because vanilla sudokus are a small set within Sukakus. in that sense it is vanilla that is the restriction (or variant) to Sukaku and not the opposite.

Here is my definition of vanilla sudokus:

Vanilla sudoku:
is a sukaku puzzle where Only a known set of Naked singles is needed to determine puzzle validity/uniqueness.

Now to the fun part (and the reason why a small part of me favours a restriction):
Can we therefore divide Sukaku puzzles into 2 separate groups; vanilla sudokus and Sukaku puzzles that are non-vanilla sudokus?
The answer should be yes (for that it requires some proper definitions) but currently the answer is no!!

Look at the definition of vanilla sudoku that I provided above: Looking at a cell that has a solved naked single (one candidate in a cell) will look like a solved hidden single (unique candidate per sector). If a vanilla sudoku clue is a naked single then you can substitute that known clue with a hidden singles (through adding that candidate to all other cells in a shared sector then adding other candidates to that cell). With our current definitions; this means that a vanilla puzzle has several equivalent non-vanilla forms (And Yes: each known vanilla puzzle can be transformed into a Pencilmark-only version in that way :idea: )

One way to guarantee that we don't have several versions of essentially the same puzzle appearing is to restrict the definition of non-vanilla further:

Desired non-vanilla: Minimal Sukaku with no hidden singles at the start (Minimal guarantees a single version of the puzzle that has cells with 1 candidate (naked singles), No hidden singles will guarantee that we don't have minimal puzzles appearing in a different form). This may need to extend to hidden doubles and hidden triples that are in more than one sector!

unDesired non-vanilla: All other Sukakus that are not vanilla sudokus nor Desired sukakus.

[Edit: corrected a small mix-up]

tarek
User avatar
tarek
 
Posts: 3762
Joined: 05 January 2006

Re: Help With Sudoku Explainer

Postby dobrichev » Sat Aug 10, 2019 4:11 pm

tarek wrote:With our current definitions; this means that a vanilla puzzle has several equivalent non-vanilla forms

This depends on equivalence definition.
In the same way you may consider all puzzles that resolve to the same solution as equivalent.

My point was the project name. Obviously minimality and existence of vanilla givens are beyond the scope of this project.

========

Maybe it is time to add links to the 2 releases in the readme file, something like
<link to serate release> - The code from 2009. Allows both interactive and batch processing of vanilla puzzles. There is no known vanilla puzzle that can't be rated.
Known issues: slow, has few known bugs that rarely cause deviations from the optimal solution path.
<link to SukakuExplainer> - Modification generally based on the odl code that allows Sukaku rating.
Known issues: Interactive mode is unstable. In batch mode puzzles that exceed solver's capabilities exist. Slow.

The exact formulation of the above I am leaving to you. :)
dobrichev
2016 Supporter
 
Posts: 1863
Joined: 24 May 2010

Re: Help With Sudoku Explainer

Postby 1to9only » Sat Aug 10, 2019 4:22 pm

dobrichev wrote:SukakuExplainer v1.2.1.4 is released.

I've downloaded this, and a number of github repository files differ from those in my development folder. And the GUI is probably broken as the changes to load 729-char sukakus have not been uploaded.

dobrichev wrote:The SE sources from this post by rjamil compiled after replacing in 2 places
Code: Select all
            if (result == RES_WARN) // warning
                return new ErrorMessage(WARNING_MSG, false);
            else // error
                return new ErrorMessage(ERROR_MSG, true);

to
Code: Select all
            if (result == RES_WARN) // warning
                return new ErrorMessage(WARNING_MSG, false, null);
            else // error
                return new ErrorMessage(ERROR_MSG, true, null);


This is a strange one as ErrorMessage.java has constructors for both types of ErrorMessages. I use the unmodified version. It may also be that I usually build using jdk-6u45 (about the same vintage as the SE code!) and I usually run using jdk-8u181 (latest is jdk-8u221!). I have not tried with jdk-11 (lts) or jdk-12.

I have now acquired a github account...
.
User avatar
1to9only
 
Posts: 4177
Joined: 04 April 2018

Re: Help With Sudoku Explainer

Postby tarek » Sat Aug 10, 2019 4:43 pm

dobrichev wrote:The exact formulation of the above I am leaving to you. :)
Fair enough

1to9only wrote:I have now acquired a github account...
Not a moment too soon :D
User avatar
tarek
 
Posts: 3762
Joined: 05 January 2006

Re: Help With Sudoku Explainer

Postby dobrichev » Sat Aug 10, 2019 6:19 pm

1to9only wrote:I've downloaded this, and a number of github repository files differ from those in my development folder. And the GUI is probably broken as the changes to load 729-char sukakus have not been uploaded.

I did my best by manually merging the several SE clones from my machine to the ones initially placed by tarek. I am not surprised there are errors. Please fix them.

1to9only wrote:This is a strange one as ErrorMessage.java has constructors for both types of ErrorMessages.

Not if the compiler cleverly turns the boolean value into an object.

1to9only wrote:I have now acquired a github account...

Nice, we are going the right direction.
dobrichev
2016 Supporter
 
Posts: 1863
Joined: 24 May 2010

Re: Help With Sudoku Explainer

Postby tarek » Sat Aug 10, 2019 8:26 pm

I thought similar to gsf's sudoku.html and serate.html that a SukakuExplainer.html man document is part of the package as well

SukakuExplainer Man document: Show
Code: Select all
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<TITLE>Sukaku Explainer serate man document</TITLE>
</HEAD>
<BODY bgcolor=white>
<PRE>
NAME
  serate - Sukaku and Sudoku Explainer command line rating
  hints - Sukaku and Sudoku Explainer hints display
  pencilmarks - Sukaku and Sudoku Pencilmark display

SYNOPSIS
  serate [ --diamond ] [ --format=FORMAT ] [ --input=FILE ] [ --output=FILE ] [ --pearl ] [ puzzle ... ]
  hints [ --input=FILE ]
  pencilmarks [ --input=FILE ]

DESCRIPTION
  serate is a Sudoku/Sukaku Explainer command line entry point that rates one or more
  input puzzles.  If an --input=FILE option is specified then 729-character per line
  Sukaku puzzles are read from that file, otherwise if the file doesn't contain
  729-character per line Sukaku puzzles then 81-character sudoku puzzle
  strings are read from that file, otherwise if 81-character puzzle operands are
  not specified the puzzles are read from the standard input.  If an --output=FILE
  option is specified then the output is written to that file, otherwise output
  is written to the standard output.  The output is controlled by the
  --format=FORMAT option.

  Ratings are floating point numbers in the range 0.0 - 20.0, rounded to the
  tenths digit.  0.0 indicates a processing error and 20.0 indicates a valid
  but otherwise unsolvable input puzzle.
 
  For GUI, hints and pencilmarks please see INVOCATION then EXAMPLES

serate OPTIONS
  -d, --diamond
      Terminate rating if the puzzle is not a diamond.
  -f, --format=FORMAT
      Format the output for each input puzzle according to FORMAT.  Format
      conversion are %CHARACTER; all other characters are output unchanged.
      The default format is %r/%p/%d.  The format conversions are:
        %d  The diamond rating.  This is the highest ER of the methods leading
            to the first candidate elimination.
        %e  The elapsed time to rate the puzzle.
        %g  The puzzle grid in 81-character [0-9] form.
        %n  The input puzzle ordinal, counting from 1.
        %p  The pearl rating.  This is the highest ER of the methods leading
            to the first cell placement.
        %r  The puzzle rating.  This is the highest ER of the methods leading
            to the puzzle solution.
        %%  The % character.
  -h, --html
      List detailed info in html.
  -i, --input=FILE
      Read 81-character puzzle strings, one per line, from FILE.  By default
      operands are treated as 81-character puzzle strings.  If no operands are
      specified then the standard input is read.
  -m, --man
      List detailed info in displayed man page form.
  -o, --output=FILE
      Write output to FILE instead of the standard output.
  -p, --pearl
      Terminate rating if the puzzle is not a pearl.
  -V, --version
      Print the Sudoku Explainer (serate) version and exit.

INVOCATION
  GUI:
  java.exe -jar SukakuExplainer.jar
 
  Command Line:
  java.exe -Xrs -Xmx500m -cp SudokuExplainer.jar diuf.sudoku.test.serate ...
 
  Display Hints:
  java.exe -Xrs -Xmx500m -cp SukakuExplainer.jar diuf.sudoku.test.hints ...
 
  Display Pencilmarks:
  java.exe -Xrs -Xmx500m -cp SukakuExplainer.jar diuf.sudoku.test.pencilmarks ...


EXAMPLES
  To rate a single or a group of puzzle(s):
  java.exe -Xrs -Xmx500m -cp SukakuExplainer.jar diuf.sudoku.test.serate --format="%g ED=%r/%p/%d" --input=puzzles.txt --output=puzzles.rated.txt
 
  To display explainer hints (output is to standard output):
  java.exe -Xrs -Xmx500m -cp SukakuExplainer.jar diuf.sudoku.test.hints --input=puzzle.txt
 
  To display explainer pencilmarks (output is to standard output):
  java.exe -Xrs -Xmx500m -cp SukakuExplainer.jar diuf.sudoku.test.pencilmarks --input=puzzle.txt
 
 
IMPLEMENTATION
  version     SukakuExplainer 1.2.1.4 (Sudoku Explainer) 2019-08-09
  author      Nicolas Juillerat
  copyright   Copyright (c) 2006-2019 Nicolas Juillerat
  license     Lesser General Public License (LGPL)
</PRE>
</BODY>
</HTML>
User avatar
tarek
 
Posts: 3762
Joined: 05 January 2006

Re: Help With Sudoku Explainer

Postby tarek » Sun Aug 11, 2019 6:54 am

I will be updating the Readme.md file by tomorrow if all goes well today

[Added]
Uploaded SuakuExplainer.html (man document) to Master
Uploaded serate.html (man document) to Serate branch
Updated Readme.md on Master

[Edit 2]
dobrichev wrote:Maybe it is time to add links to the 2 releases in the readme file, something like
<link to serate release> - The code from 2009. Allows both interactive and batch processing of vanilla puzzles. There is no known vanilla puzzle that can't be rated.
Known issues: slow, has few known bugs that rarely cause deviations from the optimal solution path.
<link to SukakuExplainer> - Modification generally based on the odl code that allows Sukaku rating.
Known issues: Interactive mode is unstable. In batch mode puzzles that exceed solver's capabilities exist. Slow.

The exact formulation of the above I am leaving to you. :)

It is amazing how presentable the page looks now :D

[EDIT 3]
I've added 2 issues (very minor) to check wording in the help files

tarek
User avatar
tarek
 
Posts: 3762
Joined: 05 January 2006

PreviousNext

Return to Interactive games

cron