View previous topic :: View next topic |
Author |
Message |
| Merri
| Joined: 02 Aug 2005 | Posts: 44 | : | | Items |
|
Posted: Sun Aug 14, 2005 6:56 pm Post subject: Sudoku file formats |
|
|
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 |
|
|
| DHallman
| Joined: 09 Aug 2005 | Posts: 24 | : | Location: Inglewood, CA 90302 USA | Items |
|
Posted: Sat Aug 20, 2005 6:10 pm Post subject: Sudoku File Formats |
|
|
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 |
|
|
| angusj Site Admin
| Joined: 18 Jun 2005 | Posts: 406 | : | | Items |
|
Posted: Sat Aug 20, 2005 9:43 pm Post subject: Re: Sudoku file formats |
|
|
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 |
|
|
| Merri
| Joined: 02 Aug 2005 | Posts: 44 | : | | Items |
|
Posted: Sat Aug 20, 2005 11:26 pm Post subject: |
|
|
"Slightly"? Urgh... my writer needs a complete rewrite for that part! My reader however reads that all fine Do you have a name for the old format? Should I just call it "Older Simple Sudoku format"? |
|
Back to top |
|
|
| dukuso
| Joined: 14 Jul 2005 | Posts: 424 | : | Location: germany | Items |
|
Posted: Sun Aug 21, 2005 3:33 am Post subject: |
|
|
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 |
|
|
| Merri
| Joined: 02 Aug 2005 | Posts: 44 | : | | Items |
|
Posted: Mon Aug 22, 2005 12:27 am Post subject: |
|
|
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 |
|
|
| dukuso
| Joined: 14 Jul 2005 | Posts: 424 | : | Location: germany | Items |
|
Posted: Mon Aug 22, 2005 7:33 am Post subject: |
|
|
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 |
|
|
| Merri
| Joined: 02 Aug 2005 | Posts: 44 | : | | Items |
|
Posted: Mon Aug 22, 2005 9:03 am Post subject: |
|
|
Well, I can make it take commandline commands. Clipboard = Windows clipboard, copy and paste stuff, Ctrl + C, Ctrl + V. |
|
Back to top |
|
|
| dukuso
| Joined: 14 Jul 2005 | Posts: 424 | : | Location: germany | Items |
|
Posted: Mon Aug 22, 2005 9:46 am Post subject: |
|
|
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 |
|
|
| Merri
| Joined: 02 Aug 2005 | Posts: 44 | : | | Items |
|
Posted: Mon Aug 22, 2005 9:55 am Post subject: |
|
|
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 |
|
|
| dukuso
| Joined: 14 Jul 2005 | Posts: 424 | : | Location: germany | Items |
|
Posted: Mon Aug 22, 2005 12:31 pm Post subject: |
|
|
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 |
|
|
| rapidlord
| Joined: 15 Sep 2005 | Posts: 2 | : | | Items |
|
Posted: Wed Sep 28, 2005 3:08 pm Post subject: |
|
|
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 |
|
|
| Rick
| Joined: 29 Sep 2005 | Posts: 1 | : | | Items |
|
Posted: Thu Sep 29, 2005 11:21 am Post subject: |
|
|
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?] |
|
Back to top |
|
|
| ChocoNutDancer
| Joined: 09 Sep 2005 | Posts: 1 | : | Location: Massachusetts, USA | Items |
|
Posted: Mon Oct 03, 2005 11:41 pm Post subject: Re: Sudoku file formats |
|
|
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 |
|
|
| Ruud Site Admin
| Joined: 17 Sep 2005 | Posts: 708 | : | Location: Netherlands | Items |
|
Posted: Wed Oct 26, 2005 11:24 pm Post subject: |
|
|
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 |
|
|
|