gsf sudz compression (Windows)

Programs which generate, solve, and analyze Sudoku puzzles

gsf sudz compression (Windows)

Postby Mathimagics » Tue Jul 23, 2019 5:17 pm

Has anybody been able to get gsf's sudoku tool to produce a SUDZ file on Windows.

I get the dreaded "SUDZ_WRITE open failure" ....

I can't test whether it can read a sudz file, of course, because I can't get it to write one! :?

Code: Select all
c:\GSF> sudoku -f%#ec TestGrids.txt -oTestGrids.sudz
sudoku: sudz SUDZ_WRITE open failure


Cheers
MM
User avatar
Mathimagics
2017 Supporter
 
Posts: 1926
Joined: 27 May 2015
Location: Canberra

Re: gsf sudz compression (Windows)

Postby creint » Tue Jul 23, 2019 7:25 pm

Following should work, don't know what parameter #ec is.

Code: Select all
sudoku -f%#0c <TestGrids.txt >TestGrids.sudz
creint
 
Posts: 393
Joined: 20 January 2018

Re: gsf sudz compression (Windows)

Postby Mathimagics » Tue Jul 23, 2019 9:45 pm

Thanks, but that "#ec" is the critical parameter, it select sudz compression for the output.

Changing it to "#0c" just gives me an exact copy of the input grids.
User avatar
Mathimagics
2017 Supporter
 
Posts: 1926
Joined: 27 May 2015
Location: Canberra

Re: gsf sudz compression (Windows)

Postby 1to9only » Tue Jul 23, 2019 10:41 pm

Amongst the gsf packages, sudz.exe is probably what you're looking for. Never used it myself!

Code: Select all
NAME
  sudz - 3x3 sudoku minlex solution grid compressor

SYNOPSIS
  sudz [ options ] [ file ... ]

DESCRIPTION
  sudz is a 3x3 sudoku minlex solution grid compressor. If no file operands
  are specified, or if a file is -, then the standard input is read.

OPTIONS
  -aN  List grids with >= N automorphisms.
  -fF  Format output according to F (default '%03b %3a %g') for each grid.
       printf(3) style width and fill apply.  The formats are:
        %a  The number of automorphisms in the range 1..648 inclusive.
        %b  The band index in the range 1..416 inclusive.
        %g  The grid in 81 char row order form.
        %i  The grid index in the range 1..5472730538 inclusive.
        %w  The number of grids in the current window.
  -i   List the window information using the default format '%10i %03b %6w %g'.
       Grid information is for the first grid in the window.
  -oF  Write output to the file F instead of the standard output.
  -u   Uncompress the input to the standard output.  This is the default.
  -w   Compress the input to the output.  The input must be lines containing
       the space separated fields: band index, number of automorphisms, and
       the 81 char row order minlex-solution-grid.  The input must be sorted
       by the minlex-solution-grid field in ascending order (or the compression
       rate will deteriorate).
User avatar
1to9only
 
Posts: 4177
Joined: 04 April 2018

Re: gsf sudz compression (Windows)

Postby Mathimagics » Tue Jul 23, 2019 10:58 pm

Sounds great, but where do you get it (a Windows version) ???

No hits on Google for "sudz.exe" ...
User avatar
Mathimagics
2017 Supporter
 
Posts: 1926
Joined: 27 May 2015
Location: Canberra

Re: gsf sudz compression (Windows)

Postby Mathimagics » Tue Jul 23, 2019 11:34 pm

It gets the same error Win32, too, so the compression seems to be unavailable on Windows. I think blue mentioned that he had the same problem ...

A pity ...

I was hoping to take the 222,278 ED grids I found with MCN=16 and post them as an attachment, since that would probably be < 256KB after compression, but that idea looks like going nowhere fast ...
User avatar
Mathimagics
2017 Supporter
 
Posts: 1926
Joined: 27 May 2015
Location: Canberra

Re: gsf sudz compression (Windows)

Postby blue » Wed Jul 24, 2019 10:03 am

Mathimagics wrote:I think blue mentioned that he had the same problem ...

It wasn't me.
blue
 
Posts: 1045
Joined: 11 March 2013

Re: gsf sudz compression (Windows)

Postby Mathimagics » Wed Jul 24, 2019 12:33 pm

I found a link to the gsf package download page: http://gsf.cococlyde.org/download/sudoku

I must have been there before as I have a copy of the 32 and 64 bit versions of the sudoku tool! (Both have the same SUDZ_WRITE problem, by the way).

And there I also found the sudz.exe file that 1to9only (thank you!) mentioned above.

It wasn't easy getting it going, but IT WORKS!! :shock:

Yes folks, we can compress/decompress to/from SUDZ files under Windows, but some effort is required. This guide should assist anybody willing to make the effort:

Installing

The exe requires MSVCR71.dll, an older version of the MSVC runtime library that few of us have, but you can get it from here:

http://www.dll-files.com/dllindex/dll-files.shtml?msvcr71

You'll get a zip file, which contains just the DLL. The path of least resistance is simply to unzip the file, and place the dll in the same directory alongside sudz.exe.

Preparing an Input File

  • the grids to be compressed must be CF grids (minlex) and these must appear in ascending order.
  • each grid must be preceded by the band index and the automorphism count. Here is a sample input file that I used for testing. It has 20 grids all from band #2, including a couple with NTA's:
GridSample.txt: Show
Code: Select all
2 1 123456789456789123789123465215937648634218597897645231378564912562391874941872356
2 1 123456789456789123789123465215937648634218957897564312342871596561392874978645231
2 2 123456789456789123789123465215937648634218957897564312361872594542391876978645231
2 1 123456789456789123789123465215937648634218957897564312361872594548391276972645831
2 1 123456789456789123789123465215937648634218957897564312361892574542371896978645231
2 1 123456789456789123789123465215937648634218957897564312361892574548371296972645831
2 1 123456789456789123789123465215937648634218957897564312362871594541392876978645231
2 1 123456789456789123789123465215937648634218957897564312378645291541392876962871534
2 1 123456789456789123789123465215937648634218957897564312378645291542391876961872534
2 1 123456789456789123789123465215937648634218957897564312378645291561392874942871536
2 1 123456789456789123789123465215937648634218957897564312378645291562391874941872536
2 1 123456789456789123789123465215937648634218957897645312342871596561392874978564231
2 2 123456789456789123789123465215937648634218957897645312361872594542391876978564231
2 1 123456789456789123789123465215937648634218957897645312361872594548391276972564831
2 1 123456789456789123789123465215937648634218957897645312361892574542371896978564231
2 1 123456789456789123789123465215937648634218957897645312361892574548371296972564831
2 1 123456789456789123789123465215937648634218957897645312362871594541392876978564231
2 1 123456789456789123789123465215937648634218957897645312378564291541392876962871534
2 1 123456789456789123789123465215937648634218957897645312378564291542391876961872534
2 1 123456789456789123789123465215937648634218957897645312378564291561392874942871536


Compressing

  • use sudz -w -o <sudz file> <input file>

Code: Select all
> sudz -w -o GridSample.sudz GridSample.txt

> dir grid*
 Directory of c:\VBprojects\Sudoku81\GSF
24/07/2019  10:15 PM               117 GridSample.sudz
24/07/2019  10:09 PM             1,740 GridSample.txt
               2 File(s)          1,857 bytes


De-Compressing

  • use sudz -f%g <sudz file> to retrieve the grids.

Output: Show
Code: Select all
> sudz -f%g GridSample.sudz
123456789456789123789123465215937648634218597897645231378564912562391874941872356
123456789456789123789123465215937648634218957897564312342871596561392874978645231
123456789456789123789123465215937648634218957897564312361872594542391876978645231
123456789456789123789123465215937648634218957897564312361872594548391276972645831
123456789456789123789123465215937648634218957897564312361892574542371896978645231
123456789456789123789123465215937648634218957897564312361892574548371296972645831
123456789456789123789123465215937648634218957897564312362871594541392876978645231
123456789456789123789123465215937648634218957897564312378645291541392876962871534
123456789456789123789123465215937648634218957897564312378645291542391876961872534
123456789456789123789123465215937648634218957897564312378645291561392874942871536
123456789456789123789123465215937648634218957897564312378645291562391874941872536
123456789456789123789123465215937648634218957897645312342871596561392874978564231
123456789456789123789123465215937648634218957897645312361872594542391876978564231
123456789456789123789123465215937648634218957897645312361872594548391276972564831
123456789456789123789123465215937648634218957897645312361892574542371896978564231
123456789456789123789123465215937648634218957897645312361892574548371296972564831
123456789456789123789123465215937648634218957897645312362871594541392876978564231
123456789456789123789123465215937648634218957897645312378564291541392876962871534
123456789456789123789123465215937648634218957897645312378564291542391876961872534
123456789456789123789123465215937648634218957897645312378564291561392874942871536
User avatar
Mathimagics
2017 Supporter
 
Posts: 1926
Joined: 27 May 2015
Location: Canberra

Re: gsf sudz compression (Windows)

Postby Mathimagics » Wed Jul 24, 2019 1:16 pm

You can use sudoku.exe to produce a grid list in the correct format for sudz.exe:

This command will almost produce a suitable sudz input file from a list of grids:

  • sudoku "-f%#Bn %#aC %v" -o <output file> <input file>

Example: Show
Code: Select all
> sudoku "-f%#Bn %#aC %v"  GridList.txt
0 1 123456789456789123789123465215937648634218597897645231378564912562391874941872356
0 1 123456789456789123789123465215937648634218957897564312342871596561392874978645231
0 2 123456789456789123789123465215937648634218957897564312361872594542391876978645231
0 1 123456789456789123789123465215937648634218957897564312361872594548391276972645831
0 1 123456789456789123789123465215937648634218957897564312361892574542371896978645231
0 1 123456789456789123789123465215937648634218957897564312361892574548371296972645831
0 1 123456789456789123789123465215937648634218957897564312362871594541392876978645231
0 1 123456789456789123789123465215937648634218957897564312378645291541392876962871534
0 1 123456789456789123789123465215937648634218957897564312378645291542391876961872534
0 1 123456789456789123789123465215937648634218957897564312378645291561392874942871536
0 1 123456789456789123789123465215937648634218957897564312378645291562391874941872536
0 1 123456789456789123789123465215937648634218957897645312342871596561392874978564231
0 2 123456789456789123789123465215937648634218957897645312361872594542391876978564231
0 1 123456789456789123789123465215937648634218957897645312361872594548391276972564831
0 1 123456789456789123789123465215937648634218957897645312361892574542371896978564231
0 1 123456789456789123789123465215937648634218957897645312361892574548371296972564831
0 1 123456789456789123789123465215937648634218957897645312362871594541392876978564231
0 1 123456789456789123789123465215937648634218957897645312378564291541392876962871534
0 1 123456789456789123789123465215937648634218957897645312378564291542391876961872534
0 1 123456789456789123789123465215937648634218957897645312378564291561392874942871536


As you can see it's in the right format, only the band index is 0 in all cases. The #Bn option apparently only works if the sudoku input is a sudz file, but we are only here because sudz input/output doesn't work, right?

Why it can't fill this i for you is a mystery (it surely could look it up in its table??), but at least it gives you a file with the right format for the compression task, and with the correct automorphism counts - so we just need to replace those leading 0's with the correct band index and you are ready to rock, well at least compress ... :?
User avatar
Mathimagics
2017 Supporter
 
Posts: 1926
Joined: 27 May 2015
Location: Canberra


Return to Software