The start of some documentation. Currently only the building directives and some bits and pieces on how to use the program. Planned are a UNIX manual page and a LaTeX document which will describe all facets of the program to you.
The sgf2misc program reads an SGF, Liberty or Ishi format go record and converts it to various output media. Currently supported output media are:
I want to thank Jim Yu for encouragement and initial beta testing of the program. Wasn't it for Jim, the program would have never been born. I also would like to thank Jim Mattson (it's in the name :-) for his suggestions and patches (for example: handicap/komi in the header and no "snap" for "rlineto" operations in gopro.eps).
You can build the program from compressed tar file by:
mkdir sgf2misc-2.6 cd sgf2misc-2.6 gunzip < ../sgf2misc-2.6.tar.gz | tar -xvf - make dependNow, before you execute the following two comamnd you might want to take a look at the destination directory in the Makefile:
HOME = /usr/localThis implies that the "make install" procedure will try to install the program in:
/usr/local/bin/sgf2miscand the library files (PostScript prolog, fonts, and such) in:
/usr/local/lib/sgf2misc/...If you prefer another place, please adjust the HOME variable. Next, build the program with:
make sgf2miscand install it with:
make installI strongly believe in portable software so I've written the source of sgf2misc with such portability in mind. During the development of the program the code has been constantly tested on these architectures:
Here's the usage (you get it with "sgf2misc -help"):
Usage: sgf2misc [options] [file] ------------------------------------------------------------------------ Option Description Default ------------------------------------------------------------------------ [-from fmt_spec] Input Go game format sgf file [sgf,liberty,sf] [-to dev_spec] Output format pstex [pstex,tex,ascii,graphic,sgf,sf,db,gif,null] [-paper paper_spec] Paper Size default [default,letter,a4wide,a4] [-tmp path] EPS directory /tmp [-scale size] Diagram size [72 = 1in] 0 [-max moves] Limit moves per figure unlimited [-figures list] Emit figures in list automatic [-diagrams list] Emit diagrams in list all [-output file] Emit output to file stdout [-coordinates] Don't print coordinates on [-text_output] Don't print text output on [-labels] Don't label moves on [-caching] Caching mode off [-verbose] Verbose mode off [-sequent] Variation(1) mode off [-flatten] Variation(2) mode off [-kibitz] Kibitz mode off [-zhuge_mode] Zhuge mode off [-statistics] Emit kibitz statistics off [-short_keys] Don't use long SGF keys off [-ppm path] Path to ppm directory /ufs/jansteen/lib/sgf2misc/ppm [-pbmbin path] Path to pbmplus tools /usr/local/pbmplus [-rgbb color] GIF Color for Black rgb\:00/00/00 [-rgbw color] GIF Color for White rgb\:ff/ff/ff [-rgbg color] GIF Color for Board rgb\:ff/e1/4b [-rgbo color] GIF Color for Outside rgb\:ff/e1/4b [-rgbr color] GIF Color for Region rgb\:ff/ff/7f [-fontsize bits] GIF image unit size 15 [-version] Print program version [-help] Print usageThe recognised syntax for the "-figures list" command line option:
-fig25-50-75-100 -fig25+50+75+100 Produce game diagram after move 25,50,75 and 100 -fig25,50,75,100 and one for the remaining moves -fig25-50-75-100-0 -fig25+50+75+100+0 -fig25,50,75,100,0 Produce game diagram after move 25,50,75 and 100 -fig%50 Produce game diagram every 50 moves
Some examples to show you what you can do with the program:
sgf2misc -zhuge -flatten -to graphic Sakata.sgfShow your Go Seigen game on the screen, page through it using spaces, quit with 'q'
sgf2misc -z -flatten -to ascii Sakata.sgf | mail jansteenMail me the ASCII version of the same game
sgf2misc -z -flatten -to pstex Sakata.sgf > Sakata.texCreate a LaTeX version of the game using PostScript diagram code (this is the default). The next step is to run LaTeX on this file and convert the resulting dvi file to PostScript.
sgf2misc -kibitz -to g IGSgame.sgfQuickly replay an IGS game on the screen For abbrevity, we've used "-to g" here (i.e. the unique initial strings) instead of "-to graphic", you can do this with all command line options and arguments.
-fontsize size GIF image unit sizeThe default size (15 pixels) will create diagrams of 19*15=285 pixels. The resulting GIF image will be approx. 4-5kb. The color of the board and outside, the board regions, and the black and white stones can be set from the command line as well:
-rgbb color GIF Color for Black -rgbw color GIF Color for White -rgbg color GIF Color for Board -rgbo color GIF Color for Outside -rgbr color GIF Color for Region
If you don't force figure breaks (with the -figure command line option) the program will try to create figures from the game itself. It will start a new diagram after it encountered:
First let me explain what move labels are:
Black 123: ---------- Not so good, better push at [a].The "Black 123:" is a move label, indicating which move the comment is talking about. You can supress move labels with the "-labels" command line option. Otherwise, sgf2misc will create them when the comment is on an actual move and when there is more than one move in the diagram.
When the user selected *not* to print the comments (-text_output) the program will automatically ignore all Mark[] and Letter[] directives in the game.
In "zhuge" mode the program automatically modifies some parts of the text blocks (which are *very* Jim Z. Yu specific):
The game branches are removed from the tree:
|g |g |---|---| |---| |g |v1 |g |v1 | | |---|---| |---| |g |v1 |g |v1 | | |---|---|---| |---|---| |g |v1 |v2 |g |v1 |v2 | | round flattened ----- ---------
The game branches are put after the variation branches:
(g (g |--(---( |--(---( )v1 |g |g )v1 | | |---(---( |---(---( )v1 |g |g )v1 | | |---(---(---( |---(---(---( )v1 )v2 |g |g )v1 )v2 )))) )))) sequential round ---------- -----
From sgf2misc version 2-3 on I've added inline Go widgets useable within pstex mode. The widgets PostScript code are in sub-directory "gowidget". The widgets are (black/white):
plus \blackplus minus \blackminus triangle \blacktriangle filled triangle \blacktrianglefilled square \blacksquare filled square \blacksquarefilledAll the above macros are also defined for white (instead of black).
The SGF specification doesn't mention anything on the syntax of the contents of "Comment[]" blocks (or "C[]" in short notation). The only obvious restriction made is that any occurence of the character ']' in the text is escaped by a preceeding '\' (to avoid that the ']' is interpreted as the end of the list). When sgf2misc writes out an SGF file obviously it will obey the above syntax, but beside that it will break the lines near position 64 (to avoid long lines) and preceed the newline with the sequence: " \", denoting that the current line is actually continued:
Comment[ This game was full of violent and nerve-straining fights. Both \ sides spent a great amount of energy and brain cells. Reflecting \ onto the board, it was a seesaw game from the beginning to the end. \ This was indeed a rare masterpiece. ]For further thoughts on paragraphs and newlines, see the file: "NEWLINES".
If you encounter problems using sgf2misc please tell me which version you are running ("sgf2misc -version") when you E-mail me the problem.
\language\englishthen just remove it from either the TeX file produced by sgf2misc or from the style file sgf.sty. Btw, in case you're interested: the "\language\english" assignment selects the English hyphenation patterns for TeX with multiple hyphenation tables compiled in.
ftp : ftp.nlnet.nl dir : pub/games/go/GoLaTeX file: README.jansteen ( 588 bytes) file: GoLaTeX.tar.Z ( 63771 bytes) file: GoLaTeX.fnt.tar.Z (380609 bytes)The file GoLaTeX.fnt.tar.Z contains 300 dpi fonts at various sizes (8pt, 10pt, 12pt, ...).
( ; Name[reference] AddWhite[ds] Comment[[Suppose W throws in first...\]] ; AddEmpty[gs] Black[cs] )The ";" seperator will allocate two move structs, one with the game/variation info, the other with a move and a removed stone. Receiving data while not having a GOMOVE available is an error. Having empty nodes is not elegant (waste of memory and disk space) but not an error.
record_event () record_var ()
record_remark() record_move ()
move[0] # possible header information move[1] # 1st move move[2] # 2nd move ...