WinMGT to SLF Converter
The WinMGT2SLF converter is a utility written by HolIgor which translates WinMGT (TM) ascii output to Sensei's Library Format (SLF (TM) :-) output.
The source format is nearly the same, which can be found in thousands of usenet articles (see rec.games.go)
Table of contents |
- Download
- Executable: http://senseis.xmp.net/files/converter/txtcon.exe
- C++ Source: http://senseis.xmp.net/files/converter/txtcon.cpp.txt
How to Use
The command line for txtcon is
PATH\txtcon.exe PATH\IN_FILE PATH\OUT_FILE
- In WinMGT go to the board position you want to convert
- File -> Save board image to -> text file, e.g. as "exercise.txt"
The file should look something like this
A B C D E F G H J K L M N O P Q R S T 19 X X X . . . . . X X O O O X X O O . O 19 18 O X X X . . . X X O . O . O X O O O . 18 17 O X X . X X . X O O O X O O X . O O O 17
etc...
- Suppose you have saved that file in the same directory as the program txtcon, e.g. c:\senseis
- Open the command prompt
- At the prompt, type "c:\senseis\txtcon c:\senseis\exercise.txt c:\senseis\converted.txt"
The directory "c:\senseis" will then contain a file "converted.txt" with the position in Sensei's Library Format (TM).
RueLue: I tried this in Linux with wine and found: you need to give the path for source and written file, or txtcon searches and writes in ~ (/home/NAME/).
and: Only one diagram per source file is possible.
If the path or name for IN_FILE or OUT_FILE contain spaces, enclose the entire filename with path in quotes, i.e
txtcon "c:\my games\in file" "c:\my games\out file"
Ascii diagrams for use in email or usenet are written by e.g WinMGT, GoGui and Quarry; and engines show these diagrams as board representation on the console, but diagrams from WinMGT differ from other: hoshi are here represented by ',' (what SL wants). txtcon doesn't replace the '+' of other programs, which SL doesn't display.
To convert an SL diagram to an SGF-file, simply click on the diagram.
User Comments
Past comments: HolIgor, (awesome contribution!), Dieter Verhofstadt
Dieter please cut and paste the first few lines of your source file so we can see what it looks like. The utility works for me. My input is from the 'save board image to text file' command in WinMGT. The file looks like this:
A B C D E F G H J K L M N O P Q R S T 19 X X X . . . . . X X O O O X X O O . O 19 18 O X X X . . . X X O . O . O X O O O . 18 17 O X X . X X . X O O O X O O X . O O O 17
etc... -- Dave Sigaty
The utility is very primitive. It does not check if the input file is really a board txt image like the one that is shown above in Dave's comment. It is does not recognize any special marks that could be made by an sgf editor. I wrote it as a simple instrument to make typing the whole board positions semi-automatic.
Let me see your txt file and I can correct the program.
Holgor
HolIgor you crazy genius!!! -- Dave Sigaty
Thanks, this is really cool. I'll try it as soon as the phone company fixes the rain damage to my home lines. Since i don't have WinMGT at work (which is where i usually peruse SL), but do have Jago... what would i need to do to get txtcon to work with Jago? -- TakeNGive (11k)
It seems to me that the format of txt image of the board in Jago is similar to WinMGT. So, the utility should work with it. Try it and if the result is somewhat funny inform me about it. A slight modification may solve the problem.
By the way, I believe that the format of the txt image of the position produced by other programs such as sgf2misc is similar, so there should not be any problem with it. Side note, as soon as a tiniest software is produced the real problems of support and portability begin :).
HolIgor
Jvt asks:
Is there a program for converting Sensei's Library format into SGF?
- HolIgor is the first and only one to program something for SLF, as far as I know.
I suppose there are many utilities out there for converting text diagrams into SGF,
- I'm not so sure about that.
but do they accept borders as defined in SLF? If there are several available utilities, which one is the simplest to use?
BTW it would be nice to include such a conversion utility (SGF to SLF and back) in the edit page.
- Has been done in How Diagrams Work
I can write a servlet if the administrators are interested. Maybe it could be done with JavaScript too, but I don't know much about JS.
About Holigor's utility: maybe the direct links would work if he adds a link to it on his web page. I suspect the web server refuses to retrieve the file if the URL is not accessed from a page hosted on the site, to prevent users from storing files without (local) HTML links.
- The direct links are now on the SL-server itself. -- Dieter
Is it possible to use the online SLF to PNG conversion offline by downloading some utility for this purpose? -- Robert
Please write an utility that converts a whole SGF-File to a (large) file containing for every position two SL-diagrams:
- one diagram with caption "Black to move", just the position
- one diagram dto, containing also the following 10 moves
and also caption "Move #124" plus the text comment!!
You can assume that the file is without variations & illegal moves (=a regular game file) (Placement of handicap stones is needed, marks not necessarily)
The user can then use cut&paste to create his SL-page.
- OK, i just found this: Generate Diagram From SGF
...not as convenient when you have several positions+don't know the move numbers. Perhaps this php-file can be changed to do the conversion for all moves.
Dieter: My folders have blanks in their name. How to make txtcon accept it?
unkx80: In Windows, enclose the entire filename in quotes, i.e.
txtcon "in file" "out file"
In Unix/Linux, use the "\" character to escape the space, i.e.
txtcon in\ file out\ file
The program did not compile out-of-the-box for me. The reason is that C++ does not guarantee that copies of istream/ostreams can be made, the function signature of txtconv has to be changed to take stream references.