Games-Go-Sgf2Dg
view release on metacpan or search on metacpan
\vglue.18in
If your SGF file contains variations, {\tt sgf2dg} will print them
and generate labels for them according to a logical scheme.
We also offer an alternative. The {\tt C} program {\tt sgfsplit} will
create from the file a sequence of other SGF files each containing
one variation. The normal usage is {\tt sgfsplit} [{\it filename}]. This will
create from the file [{\it filename}] or [{\it filename}]{\tt .sgf} a sequence of
files called [{\it filename}]{\tt .0.sgf}, [{\it filename}]{\tt .1.sgf}, etc. The first
file contains the main line, the remaining files, variations. Also
created is an executable shell script called [{\it filename}]{\tt .sgf2dg}
which contains suggested commands for invoking {\tt sgf2dg}. In particular,
breakpoints are specified for each variation. You may wish to edit this file
before executing it to fine tune the board sizes. If you invoke {\tt sgfsplit}
in the form {\tt sgfsplit} [{\it filename}] [{\it extra parameters}] the
extra parameters (such as {\tt -simple}) are passed along in
[{\it filename}]{\tt .sgf2dg}.
One may ask why {\tt sgfsplit} is needed since {\tt sgf2dg} has built-in
support for variations. One possible reason is that by splitting up the
file into variational components, one may supply different values of
the {\tt -t}, {\tt -b}, {\tt -l} and {\tt -r} parameters. This requires
editing the {\tt [filename].sgf2dg} file before executing it.
\vglue1in
\centerline{\titlefont Small Boards}
\vglue.25in
\hbox to\hsize{\vbox to 108.0 pt{\hsize= 108.0 pt\goo
\0??<\0??(\048(\043(\046(\0??(\042(\0??(\0??>
\0??[\049+\017+\018+\0??+\022+\041+\040+\0??]
\0??[\019+\044+\021+\016+\009+\001+\0??+\0??]
\0??[\023+\003+\024+\014+\008+\015+\011+\045]
\0??[\020+\025+\050+\0??*\0??+\013+\010+\012]
\0??[\026+\0??+\029+\028+\032+\006+\005+\0??]
\0??[\0??+\004+\027+\031+\036+\002+\007+\0??]
\0??[\0??+\030+\0??+\037+\034+\033+\035+\0??]
\0??,\0??)\0??)\0??)\039)\038)\0??)\0??)\0??.
\hfil\break\vglue10pt
\hbox{\rm \textstone{\goo\047=} at \textstone{\goo\021=}}\hfil\break}\hfil
\vbox to 108.9pt{\hsize=1.8in\rm\tolerance=10000\vfil
The most commonly used small board sizes are $9\times9$ and $13\times13$.
If {\tt sgf2dg} is used on a game of any of these sizes, an
appropriate small board is used. The board size is set using the SGF
property~{\tt SZ}.\vfil}\hfil
\vbox to 108.0 pt{\hsize= 108.0 pt\goo
\0??<\062(\- !(\0??(\- !(\0??(\- !(\0??(\0??>
\064[\- @+\- @+\- !+\0??+\- !+\- @+\- !+\0??]
\0??[\- @+\053+\- @+\- !+\- @+\- @+\056+\054]
\063[\- @+\- @+\- !+\- !+\- !+\- @+\- @+\- @]
\061[\- !+\- @+\- !+\0??*\052+\- @+\- !+\- !]
\065[\- !+\051+\- @+\- !+\- !+\- !+\- @+\055]
\060[\066+\- !+\- @+\- @+\- !+\- !+\- @+\0??]
\059[\057+\- !+\067+\- @+\- !+\- @+\- @+\0??]
\068,\058)\069)\070)\- @)\- !)\0??)\0??)\0??.
\hfil\break}}\vskip 40pt
The FF4 specification for SGF files allows {\tt SZ[X:Y]} where {\tt X} and
{\tt Y} are arbitrary numbers. {\tt sgf2dg} supports this syntax.
\vfil\eject
\centerline{\titlefont\TeX\ Macros}
\bigbreak
Using the {\tt sgf2dg} translator one need not worry about writing \TeX\
code. Nevertheless with some understanding of how \TeX\ works, GOOE/{\tt
sgf2dg} becomes a more powerful system. One method is to use {\tt sgf2dg
-simple} to create \TeX\ files, which may then be edited and merged into a
larger document. For this, some understanding of how \TeX\ works is useful.
(The unedited output of {\tt sgf2dg -simple} is not beautiful---this
option is perhaps {\it only} useful if you intend to edit its output.
But if this is your intention, {\tt sgf2dg -simple} will produce a file
as uncluttered as possible.)
The ultimate source for \TeX nical enlightenment is of course
{\it The \TeX\ Book} by Donald Knuth (Addison-Wesley, 1984). We will try
to explain a few things which may be helpful to the user.
The file {\tt gooemacs.tex} contains macros needed to typeset Go games. You
may either paste these into the beginning of a file, or input them.
The most important macros defined in {\tt gooemacs.tex} are {\tt \\goo} and
{\tt\\goe}. These toggle Go modes in which the black stones have odd numbers
({\tt \\goo}) or even numbers ({\tt \\goe}).
{\tt gotcmacs.tex} is an alternative to {\tt gooemacs.tex}, implementing
a two-column format. The macros in {\tt gotcmacs.tex} are used if you run
{\tt sgf2dg} in the {\tt -twoColumn} mode.
Here is the \TeX\ code needed to produce an empty Go board, with some text
alongside, as on the following page:
\vfil
{\seventtt\parindent=0pt\baselineskip=9pt\obeylines
\def\[{{\char'173}}
\def\]{{\char'175}}
\\hbox to \\hsize \[\\vbox\[\\hsize=228pt\\goo
\\0??<\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??(\\0??>
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??*\\0??+\\0??+\\0??+\\0??+\\0??+\\0??*\\0??+\\0??+\\0??+\\0??+\\0??+\\0??*\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??*\\0??+\\0??+\\0??+\\0??+\\0??+\\0??*\\0??+\\0??+\\0??+\\0??+\\0??+\\0??*\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??*\\0??+\\0??+\\0??+\\0??+\\0??+\\0??*\\0??+\\0??+\\0??+\\0??+\\0??+\\0??*\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??[\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??+\\0??]
\\0??,\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??)\\0??.\]
\\hfil
\\vbox to 228pt\[\\hsize=1.8in\\tolerance=10000\\vglue6pt
\\noindent\[\\bf Example 1 (left).\] Empty Go board. Blah blah blah etc.
\\vfil\]\]
}
\vfil\eject
( run in 1.157 second using v1.01-cache-2.11-cpan-5735350b133 )