Sudoku Programmers Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in          Games  Calendar

Log in to check your private messagesLog in to check your private messages   

Sudoku file formats
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Software
View previous topic :: View next topic  
Author Message
Merri

Joined: 02 Aug 2005
Posts: 44
:

Items
PostPosted: Sun Aug 14, 2005 6:56 pm    Post subject: Sudoku file formats Reply with quote

I've seen several different file formats out there. As I'm making a converter feature to my program, I'd like to confirm the formats and possibly get to know about other formats. Thus, here are what I have this far:

Web friendly format (*.txt)
Basically 81 characters (. and 1-9), multiple puzzles separated by CRLF.

VBForums Contest format (*.msk;*.sol)
Each row in its own line, separated by CRLF.
Code:
.........
.........
.........
.........
.........
.........
.........
.........
.........


SadMan Software Sudoku format (*.sdk)
Like the VBForums format, but starts with "[Puzzle]" and a CRLF.

Code:
[Puzzle]
.........
.........
.........
.........
.........
.........
.........
.........
.........


Simple Sudoku format (*.ss)
Block columns separated by |, block rows separated by -, each line separated by a CRLF.

Code:
...|...|...
...|...|...
...|...|...
-----------
...|...|...
...|...|...
...|...|...
-----------
...|...|...
...|...|...
...|...|...


SuDoku Solver format (*.spf)
Like the above, but each character is surrounded by a space and collision point of | and - is marked with a +.

Code:
 . . . | . . . | . . .
 . . . | . . . | . . .
 . . . | . . . | . . .
-------+-------+------
 . . . | . . . | . . .
 . . . | . . . | . . .
 . . . | . . . | . . .
-------+-------+------
 . . . | . . . | . . .
 . . . | . . . | . . .
 . . . | . . . | . . .



I've been thinking about creating a binary format file instead of a text format, which could have all kinds of information in a somewhat compact format. Besides being able to hold a sudoku of any size, it could also contain file author/generator details in Unicode (UTF-16 or UTF-8). Don't know if there is a need for an international format... just a thought that it would be nice if there would be a strict format.
Back to top
View user's profile Send private message
DHallman

Joined: 09 Aug 2005
Posts: 24
:
Location: Inglewood, CA 90302 USA

Items
PostPosted: Sat Aug 20, 2005 6:10 pm    Post subject: Sudoku File Formats Reply with quote

Merri

I have seen formats where the empty cell is designated as 0 | null | . | space| .

Once this is defined then all other characters can be ignored on input.

Output however needs to be explicity defined.

David
Back to top
View user's profile Send private message Send e-mail
angusj
Site Admin
Joined: 18 Jun 2005
Posts: 406
:

Items
PostPosted: Sat Aug 20, 2005 9:43 pm    Post subject: Re: Sudoku file formats Reply with quote

Merri wrote:
I'd like to confirm the formats and possibly get to know about other formats.


Simple Sudoku format (*.ss)

The format has changed slightly. It's now ...
Code:
 *-----------*
 |...|...|...|
 |...|...|...|
 |...|...|...|
 |---+---+---|
 |...|...|...|
 |...|...|...|
 |...|...|...|
 |---+---+---|
 |...|...|...|
 |...|...|...|
 |...|...|...|
 *-----------*
Back to top
View user's profile Send private message Visit poster's website
Merri

Joined: 02 Aug 2005
Posts: 44
:

Items
PostPosted: Sat Aug 20, 2005 11:26 pm    Post subject: Reply with quote

"Slightly"? Urgh... my writer needs a complete rewrite for that part! My reader however reads that all fine Smile Do you have a name for the old format? Should I just call it "Older Simple Sudoku format"?
Back to top
View user's profile Send private message
dukuso

Joined: 14 Jul 2005
Posts: 424
:
Location: germany

Items
PostPosted: Sun Aug 21, 2005 3:33 am    Post subject: Reply with quote

There had been other formats as well in the forums here.

I assume "." or "*" or "0" or (maybe,not sure) "-" for the empty cells.
Then I just take the first 81 characters which are digits or one of those characters, while ignoring any other characters.

It's more difficult with 16*16 sudokus and higher where
some people use 2-digit-decimal-numbers (menneske)
others use 0,1,..,E,F hexadecimal numbers,
some use 1,2,..,E,F,G hexadecimals without 0 or even
the 0 for empty cells.
Others use A,B,..,O,P or even lower-case letters.

My program tries to detect the size of the included sudokus,
but that's difficult when there are not only sudokus but also
other text in the file.


my favourite is one sudoku with just 81 characters, "." for empty
spaces, per line followed by cr/lf (for 9*9)
That makes it easy to count and sort the sudokus, check
for doublettes, with normal software.

There should be a free,small and easy-to-use program however
which displays them in a human-solver-friendly format too.
If noone writes one, then I'll do...
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Merri

Joined: 02 Aug 2005
Posts: 44
:

Items
PostPosted: Mon Aug 22, 2005 12:27 am    Post subject: Reply with quote

I'm actually doing a clipboard converter right now. You can change the format to whichever you like and also use it to solve the puzzle so that it is able to retain the format that was used as an input. I've a couple of ideas on how to get * and - accounted correctly (which are also used to draw the borders on sudokus). I don't like those formats though...

Anyways, I hope I can push the converter proggie out soon.
Back to top
View user's profile Send private message
dukuso

Joined: 14 Jul 2005
Posts: 424
:
Location: germany

Items
PostPosted: Mon Aug 22, 2005 7:33 am    Post subject: Reply with quote

what's a clipboard converter ? Can you make a commandline utility,
which lets me convert sudokus in a file from batch-processing
or from a child-process ?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Merri

Joined: 02 Aug 2005
Posts: 44
:

Items
PostPosted: Mon Aug 22, 2005 9:03 am    Post subject: Reply with quote

Well, I can make it take commandline commands. Clipboard = Windows clipboard, copy and paste stuff, Ctrl + C, Ctrl + V.
Back to top
View user's profile Send private message
dukuso

Joined: 14 Jul 2005
Posts: 424
:
Location: germany

Items
PostPosted: Mon Aug 22, 2005 9:46 am    Post subject: Reply with quote

Merri, I think commandline is much better, it can be
automized and used in the programming environment,
it doesn't depend on other Windows-stuff (i.e.graphics)
which might crash (occasionally).
It's probably also easier to be converted to other environments.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Merri

Joined: 02 Aug 2005
Posts: 44
:

Items
PostPosted: Mon Aug 22, 2005 9:55 am    Post subject: Reply with quote

Humm... well, I could write an application using FreeBASIC, which can compile to Windows and Linux. It is however different from the idea which I were planning to do. The idea in the clipboard app is the ease of use (you can copy text to clipboard using a browser, paste to the program and format so you can read the board better... solve it if the need be, validate...
Back to top
View user's profile Send private message
dukuso

Joined: 14 Jul 2005
Posts: 424
:
Location: germany

Items
PostPosted: Mon Aug 22, 2005 12:31 pm    Post subject: Reply with quote

you're always saying "you can", but my computer is much better
with sudokus than I am. So I want her to do all that for me.
But it can't do mouseclicks etc. automatically.
My computer and I, we don't like all this Windows stuff
and we are longing back to old DOS-times where you could
do everything from commandline.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
rapidlord

Joined: 15 Sep 2005
Posts: 2
:

Items
PostPosted: Wed Sep 28, 2005 3:08 pm    Post subject: Reply with quote

it`s not bad idea to have three tables in one file, one fixed table (actual problem) , user input table, and user anotation input table, so you can make snapshot of current game any time, not just starting state of table.
Back to top
View user's profile Send private message
Rick

Joined: 29 Sep 2005
Posts: 1
:

Items
PostPosted: Thu Sep 29, 2005 11:21 am    Post subject: Reply with quote

I want to add save and open options to my program and searched here to find if there is a standard file format. From Merri's post there appears to be several commonly used formats but no standard.

For copy and paste I have used this format:

Code:
.65.....8
7..86.4..
....2...9
.4...1..2
...2.7...
3..5...7.
4...5....
..1.79..3
9.....26.


I had seen it used and wanted to be able to copy it into my program. It seems sensible for copy/paste format to be the same as the file format so it should be suitable for viewing in forums. The above format is not as nice to look at as some of the others.

I suppose the real question is what is the most commonly used format as I would be better off going with the majority.



[BTW, the above puzzle is # 120 (tough) in the Daily Telegraph's first Sudoku book. After filling in all the easy stuff using basic scanning techniques I reach this position:
Code:
265194738
7.986.42.
..472.6.9
647931..2
..82473.6
3.2586.74
4.6352...
.21679.43
9.341826.

and I can't see any way to progress apart from what would essentially be trial and error (or you could call it one big chain). I am not very experienced with Swordfish and x-wings, xy-wings, etc and haven't programmed them in yet. Can you see a non T&E technique I have missed that would solve it?]
Code:
Back to top
View user's profile Send private message
ChocoNutDancer

Joined: 09 Sep 2005
Posts: 1
:
Location: Massachusetts, USA

Items
PostPosted: Mon Oct 03, 2005 11:41 pm    Post subject: Re: Sudoku file formats Reply with quote

angusj wrote:
Merri wrote:
I'd like to confirm the formats and possibly get to know about other formats.


Simple Sudoku format (*.ss)

The format has changed slightly. It's now ...
Code:
 *-----------*
 |...|...|...|
 |...|...|...|
 |...|...|...|
 |---+---+---|
 |...|...|...|
 |...|...|...|
 |...|...|...|
 |---+---+---|
 |...|...|...|
 |...|...|...|
 |...|...|...|
 *-----------*


I would get rid of the asterisks to mark the corners. it doesn't add anything useful and someone might want a format where an * is used for an empty cell.

what I use in my code is this format:
Code:

 ------- ------- -------
| . . . | . 7 . | 9 4 . |
| . . . | . 9 . | . . 5 |
| 3 . . | . . 5 | . 7 . |
 ------- ------- -------
| . . 7 | 4 . . | 1 . . |
| 4 6 3 | . . . | . . . |
| . . . | . . 7 | . 8 . |
 ------- ------- -------
| 8 . . | . . . | . . . |
| 7 . . | . . . | . 2 8 |
| . 5 . | 2 6 . | . . . |
 ------- ------- -------

because having a separator between cells allows you to store partial solutions, or a work-in-progress, something I definitely want to be able to do. like this:
Code:
 ------------------- ------------------- -------------------
| 1256  12    1258  | 1368  7     1236  | 9     4     1236  |
| 126   7     1248  | 1368  9     12346 | 2368  136   5     |
| 3     1249  12489 | 168   1248  5     | 268   7     126   |
 ------------------- ------------------- -------------------
| 259   8     7     | 4     235   2369  | 1     3569  2369  |
| 4     6     3     | 1589  1258  129   | 257   59    279   |
| 1259  129   1259  | 3569  235   7     | 23456 8     23469 |
 ------------------- ------------------- -------------------
| 8     12349 12469 | 7     1345  1349  | 456   1569  1469  |
| 7     1349  1469  | 1359  1345  1349  | 456   2     8     |
| 19    5     149   | 2     6     8     | 347   139   13479 |
 ------------------- ------------------- -------------------


you could still make a more condensed output when there are no partials and still have the same routine handle it by counting the number of digits or dots to detect what mode the data is in.

Code:

 --- --- ---
|...|.7.|94.|
|...|.9.|..5|
|3..|..5|.7.|
 --- --- ---
|..7|4..|1..|
|463|...|...|
|...|..7|.8.|
 --- --- ---
|8..|...|...|
|7..|...|.28|
|.5.|26.|...|
 --- --- ---


and the same routine should be able to handle this as well:
Code:

....7.94.
....9...5
3....5.7.
..74..1..
463......
.....7.8.
8........
7......28
.5.26....


and the same code would still work if you added a space, comma, or | in between each triple.
Back to top
View user's profile Send private message Visit poster's website
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Wed Oct 26, 2005 11:24 pm    Post subject: Reply with quote

I've created an XSD for sudoku puzzles,
which can also be used to save (remaining) candidates and coloring information, as well as some meta-tags.

I've left open the possibility to extend this XSD to include exotic Sudokus, but I haven't defined any of them yet, since I do not use them in Sudo Cue.

Here is the link to the XSD

Here is a link to a sample XML

I know it is still a first version, but I needed a save format with candidate and coloring information, so please give me some feedback if you want to use this definition, but need more information in it. Any other comments are welcome.

I'll have this implemented in the next release of Sudo Cue.

Ruud
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Software All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
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 vote in polls in this forum
Sudoku Programmers topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group

Igloo Theme Version 1.0 :: Created By: Andrew Charron