| 1 |
\documentstyle[11pt,go]{article} |
| 2 |
|
| 3 |
\textwidth=6.5truein |
| 4 |
\textheight=8.9truein |
| 5 |
\oddsidemargin=0pt |
| 6 |
\topmargin=-24pt |
| 7 |
\font\gosign=gosign50 at 50truept |
| 8 |
|
| 9 |
\title{Go diagrams with \TeX \\[6pt] \gosign\char0} |
| 10 |
\author{Hanna Ko{\l}odziejska\thanks{I wrote this paper in April 1990, |
| 11 |
during my work in the Institute of Informatics at the |
| 12 |
Warsaw University.} \\ |
| 13 |
{\sf MacroSoft}, Ltd. \\ |
| 14 |
ul.~Chro\'scickiego 49 \\ |
| 15 |
02-414 Warsaw, Poland} |
| 16 |
|
| 17 |
\begin{document} |
| 18 |
\maketitle |
| 19 |
|
| 20 |
\noindent |
| 21 |
Encoureged by Zalman Rubinstein, who described his chess |
| 22 |
diagrams in TUGboat vol.~10 no.~2 [1], I have prepared some |
| 23 |
special fonts and \TeX\ macros to be used in typesetting go |
| 24 |
diagrams. For all the people who have never yet played go I found |
| 25 |
the following introduction to the game~[2]: |
| 26 |
|
| 27 |
\begin{quotation} |
| 28 |
\em |
| 29 |
Go is one of the most ancient, interesting, and rewarding of all |
| 30 |
board games. [\ldots] It is played on a wooden board marked with |
| 31 |
nineteen vertical and nineteen horizontal lines. The pieces used |
| 32 |
are disks of slate and white shell slightly more than two |
| 33 |
centimeters in diameter. These, even made of plastic or glass, |
| 34 |
as in mass-produced sets, are called stones. They are played on |
| 35 |
the intersections formed by the lines on the board, not within |
| 36 |
the squares. The board is empty at the beginning of the game, |
| 37 |
and the two players take turns placing stones on it one at a |
| 38 |
time, one player playing black the other playing white. Once |
| 39 |
played, a stone remains in its place, not moving about from |
| 40 |
point to point.\par |
| 41 |
\end{quotation} |
| 42 |
|
| 43 |
\noindent |
| 44 |
Go diagrams are easy to read. \textblack{1} is the first stone |
| 45 |
played, \textwhite{2} the second, and so on. |
| 46 |
|
| 47 |
In order to facilitate inserting go diagrams in a text both in |
| 48 |
Plain \TeX\ and \LaTeX, I decided to generate with Metafont all |
| 49 |
the symbols needed, even lines and circles, and to put them in |
| 50 |
three kinds of fonts: |
| 51 |
\begin{enumerate} |
| 52 |
\item fonts with black stones, eg.\ go1bla10, go2bla10 (go black stones at 10pt); |
| 53 |
\item fonts with white stones, eg.\ go1whi10, go2whi10 (go white stones at 10pt); |
| 54 |
\item fonts with additional symbols, like intersections of |
| 55 |
lines, border lines, etc., eg.\ go10 (go symbols at 10pt). |
| 56 |
\end{enumerate} |
| 57 |
Probably two more fonts will be needed with black and white |
| 58 |
stones numbered over~255, because games which last over |
| 59 |
300~moves are not seldom! |
| 60 |
|
| 61 |
The macros for coding go diagrams are gathered in the `go.sty' |
| 62 |
file. In the macros each line intersection is identified by the |
| 63 |
row label (one of the letters: a, b, c, d, e, f, g, h, i, k, l, |
| 64 |
m, n, o, p, q, r, s,~t) and the column number (from 1 to~19). |
| 65 |
After issuing the command: |
| 66 |
\begin{center} |
| 67 |
\verb+\input go.sty+ |
| 68 |
\end{center} |
| 69 |
the current go diagram is initialized (with no stones on it). |
| 70 |
Later in your text you can clear the whole diagram or only a |
| 71 |
part of it by introducing one of the commands: |
| 72 |
\begin{center} |
| 73 |
\verb+\inifulldiagram+ |
| 74 |
\end{center} |
| 75 |
or |
| 76 |
\begin{center} |
| 77 |
\verb+\inidiagram+ \it with parameters. |
| 78 |
\end{center} |
| 79 |
For example, {\tt \verb+\inifulldiagram+} is equivalent to: |
| 80 |
\begin{center} |
| 81 |
\verb*+\inidiagram a-t:1-19 + |
| 82 |
\end{center} |
| 83 |
(with a space limiting the fourth parameter). |
| 84 |
|
| 85 |
The same rule stands also for showing diagrams: |
| 86 |
\begin{center} |
| 87 |
\verb+\showfulldiagram+ |
| 88 |
\end{center} |
| 89 |
is equivalent to: |
| 90 |
\begin{center} |
| 91 |
\verb*+\showdiagram a-t:1-19 + |
| 92 |
\end{center} |
| 93 |
Partial diagrams are often used to show go problems, their |
| 94 |
solutions and different variations of moves. |
| 95 |
|
| 96 |
Putting a stone on the board is coded by the command: |
| 97 |
\begin{center} |
| 98 |
\verb+\pos+ \it with parameters. |
| 99 |
\end{center} |
| 100 |
|
| 101 |
Lets consider an example: a problem to solve (Dia.~1) and its |
| 102 |
solution (Dia.~2). |
| 103 |
|
| 104 |
\gofontsize{20} |
| 105 |
\pos{a}{5}=\white. |
| 106 |
\pos{a}{6}=\black. |
| 107 |
\pos{b}{3}=\white. |
| 108 |
\pos{b}{4}=\white. |
| 109 |
\pos{b}{5}=\white. |
| 110 |
\pos{b}{6}=\black. |
| 111 |
\pos{c}{3}=\white. |
| 112 |
\pos{c}{4}=\black. |
| 113 |
\pos{c}{5}=\black. |
| 114 |
\pos{d}{3}=\white. |
| 115 |
\pos{e}{2}=\black. |
| 116 |
\pos{e}{3}=\black. |
| 117 |
\pos{e}{4}=\black. |
| 118 |
\pos{e}{6}=\black{\triangle} |
| 119 |
\begin{figure}[htb] |
| 120 |
$$ |
| 121 |
\showdiagram a-g:1-9 |
| 122 |
$$ |
| 123 |
\begin{center} Dia. 1 \end{center} |
| 124 |
\end{figure} |
| 125 |
|
| 126 |
\vspace*{-12truept} |
| 127 |
\begin{verbatim} |
| 128 |
\input go.sty % inputs macros |
| 129 |
\gofontsize{20} % chooses the size of stones and other |
| 130 |
% symbols (default=10pt) |
| 131 |
\pos{a}{5}=\white. % puts a white stone (without any number) |
| 132 |
\pos{a}{6}=\black. % puts a black stone (without any number) |
| 133 |
% on the a6 intersection |
| 134 |
\pos{b}{3}=\white. |
| 135 |
\pos{b}{4}=\white. |
| 136 |
\pos{b}{5}=\white. |
| 137 |
\pos{b}{6}=\black. |
| 138 |
\pos{c}{3}=\white. |
| 139 |
\pos{c}{4}=\black. |
| 140 |
\pos{c}{5}=\black. |
| 141 |
\pos{d}{3}=\white. |
| 142 |
\pos{e}{2}=\black. |
| 143 |
\pos{e}{3}=\black. |
| 144 |
\pos{e}{4}=\black. |
| 145 |
\pos{e}{6}=\black{\triangle} % puts a black stone with |
| 146 |
% a triangle |
| 147 |
$$ % centering |
| 148 |
\showdiagram a-g:1-9 % the result is shown in Dia. 1 |
| 149 |
$$ |
| 150 |
\pos{b}{1}=\black{1} % puts a black stone with 1 |
| 151 |
\pos{c}{2}=\letter{b} % puts a letter `b' on |
| 152 |
% the c2 intersection |
| 153 |
\pos{d}{2}=\letter{a} |
| 154 |
\gofontsize{10} % changes the size of stones and |
| 155 |
% other symbols |
| 156 |
$$ |
| 157 |
\showfulldiagram % as in Dia. 2. |
| 158 |
$$ |
| 159 |
\inifulldiagram % clears a board |
| 160 |
\end{verbatim} |
| 161 |
\smallskip |
| 162 |
|
| 163 |
\pos{b}{1}=\black{1} |
| 164 |
\pos{c}{2}=\letter{b} |
| 165 |
\pos{d}{2}=\letter{a} |
| 166 |
\gofontsize{10} |
| 167 |
\begin{figure}[htb] |
| 168 |
$$ |
| 169 |
\showfulldiagram |
| 170 |
$$ |
| 171 |
\begin{center} Dia. 2 \end{center} |
| 172 |
\end{figure} |
| 173 |
\inifulldiagram |
| 174 |
|
| 175 |
\noindent |
| 176 |
An example of a real game is shown in Dia.~3 [3]. |
| 177 |
|
| 178 |
% DIAGRAM 3 |
| 179 |
% |
| 180 |
\pos{a}{1}=\white{194} |
| 181 |
\pos{a}{3}=\black{191} |
| 182 |
\pos{a}{5}=\black{187} |
| 183 |
\pos{a}{6}=\white{186} |
| 184 |
\pos{a}{8}=\black{181} |
| 185 |
\pos{a}{9}=\white{190} |
| 186 |
\pos{a}{12}=\black{175} |
| 187 |
% |
| 188 |
\pos{b}{1}=\black{135} |
| 189 |
\pos{b}{2}=\white{184} |
| 190 |
\pos{b}{3}=\white{182} |
| 191 |
\pos{b}{4}=\black{183} |
| 192 |
\pos{b}{5}=\black{193} |
| 193 |
\pos{b}{6}=\white{178} |
| 194 |
\pos{b}{8}=\black{179} |
| 195 |
\pos{b}{9}=\white{172} |
| 196 |
\pos{b}{10}=\white{174} |
| 197 |
\pos{b}{12}=\black{93} |
| 198 |
\pos{b}{13}=\white{92} |
| 199 |
\pos{b}{14}=\white{142} |
| 200 |
% |
| 201 |
\pos{c}{1}=\white{132} |
| 202 |
\pos{c}{2}=\black{133} |
| 203 |
\pos{c}{3}=\white{196} |
| 204 |
\pos{c}{4}=\black{3} |
| 205 |
\pos{c}{5}=\black{189} |
| 206 |
\pos{c}{6}=\white{176} |
| 207 |
\pos{c}{7}=\black{17} |
| 208 |
\pos{c}{8}=\black{173} |
| 209 |
\pos{c}{9}=\black{171} |
| 210 |
\pos{c}{10}=\white{168} |
| 211 |
\pos{c}{11}=\black{195} |
| 212 |
\pos{c}{12}=\black{57} |
| 213 |
\pos{c}{13}=\black{141} |
| 214 |
\pos{c}{14}=\white{10} |
| 215 |
\pos{c}{15}=\white{52} |
| 216 |
% |
| 217 |
\pos{d}{1}=\white{134} |
| 218 |
\pos{d}{2}=\black{137} |
| 219 |
\pos{d}{3}=\black{13} |
| 220 |
\pos{d}{4}=\white{188} |
| 221 |
\pos{d}{5}=\black{15} |
| 222 |
\pos{d}{6}=\black{177} |
| 223 |
\pos{d}{7}=\white{180} |
| 224 |
\pos{d}{8}=\black{21} |
| 225 |
\pos{d}{9}=\white{170} |
| 226 |
\pos{d}{10}=\black{169} |
| 227 |
\pos{d}{11}=\black{9} |
| 228 |
\pos{d}{13}=\white{154} |
| 229 |
\pos{d}{14}=\black{143} |
| 230 |
\pos{d}{15}=\black{51} |
| 231 |
\pos{d}{16}=\white{2} |
| 232 |
\pos{d}{17}=\white{54} |
| 233 |
\pos{d}{18}=\white{24} |
| 234 |
% |
| 235 |
\pos{e}{1}=\white{140} |
| 236 |
\pos{e}{2}=\white{136} |
| 237 |
\pos{e}{4}=\white{12} |
| 238 |
\pos{e}{7}=\white{14} |
| 239 |
\pos{e}{8}=\white{192} |
| 240 |
\pos{e}{9}=\white{20} |
| 241 |
\pos{e}{13}=\white{160} |
| 242 |
\pos{e}{16}=\black{53} |
| 243 |
% |
| 244 |
\pos{f}{2}=\white{62} |
| 245 |
\pos{f}{3}=\white{64} |
| 246 |
\pos{f}{4}=\white{58} |
| 247 |
\pos{f}{6}=\white{16} |
| 248 |
\pos{f}{7}=\white{70} |
| 249 |
\pos{f}{8}=\white{166} |
| 250 |
\pos{f}{10}=\white{158} |
| 251 |
\pos{f}{11}=\white{50} |
| 252 |
\pos{f}{13}=\white{144} |
| 253 |
\pos{f}{17}=\black{23} |
| 254 |
% |
| 255 |
\pos{g}{1}=\white{84} |
| 256 |
\pos{g}{2}=\black{63} |
| 257 |
\pos{g}{3}=\white{60} |
| 258 |
\pos{g}{4}=\black{19} |
| 259 |
\pos{g}{5}=\black{59} |
| 260 |
\pos{g}{6}=\black{65} |
| 261 |
\pos{g}{7}=\white{66} |
| 262 |
\pos{g}{8}=\black{69} |
| 263 |
\pos{g}{9}=\white{148} |
| 264 |
\pos{g}{10}=\black{157} |
| 265 |
\pos{g}{11}=\white{76} |
| 266 |
\pos{g}{14}=\black{81} |
| 267 |
\pos{g}{15}=\black{87} |
| 268 |
\pos{g}{18}=\black{139} |
| 269 |
% |
| 270 |
\pos{h}{2}=\white{82} |
| 271 |
\pos{h}{3}=\black{61} |
| 272 |
\pos{h}{7}=\black{67} |
| 273 |
\pos{h}{8}=\white{68} |
| 274 |
\pos{h}{9}=\white{22} |
| 275 |
\pos{h}{10}=\black{147} |
| 276 |
\pos{h}{11}=\black{75} |
| 277 |
\pos{h}{12}=\black{77} |
| 278 |
\pos{h}{14}=\black{79} |
| 279 |
\pos{h}{15}=\white{80} |
| 280 |
\pos{h}{17}=\black{123} |
| 281 |
\pos{h}{18}=\white{138} |
| 282 |
% |
| 283 |
\pos{i}{1}=\white{94} |
| 284 |
\pos{i}{2}=\black{83} |
| 285 |
\pos{i}{4}=\black{5} |
| 286 |
\pos{i}{6}=\white{18} |
| 287 |
\pos{i}{7}=\black{71} |
| 288 |
\pos{i}{15}=\white{74} |
| 289 |
\pos{i}{17}=\black{55} |
| 290 |
\pos{i}{18}=\white{120} |
| 291 |
% |
| 292 |
\pos{k}{2}=\black{95} |
| 293 |
\pos{k}{7}=\black{73} |
| 294 |
\pos{k}{8}=\white{86} |
| 295 |
\pos{k}{9}=\white{72} |
| 296 |
\pos{k}{10}=\black{165} |
| 297 |
\pos{k}{11}=\black{11} |
| 298 |
\pos{k}{17}=\black{119} |
| 299 |
\pos{k}{18}=\white{118} |
| 300 |
% |
| 301 |
\pos{l}{4}=\black{49} |
| 302 |
\pos{l}{6}=\black{89} |
| 303 |
\pos{l}{7}=\white{88} |
| 304 |
\pos{l}{8}=\black{127} |
| 305 |
\pos{l}{9}=\white{128} |
| 306 |
\pos{l}{10}=\black{115} |
| 307 |
\pos{l}{13}=\white{116} |
| 308 |
\pos{l}{15}=\white{78} |
| 309 |
\pos{l}{16}=\black{121} |
| 310 |
\pos{l}{17}=\white{56} |
| 311 |
\pos{l}{18}=\black{117} |
| 312 |
% |
| 313 |
\pos{m}{6}=\black{91} |
| 314 |
\pos{m}{7}=\white{90} |
| 315 |
\pos{m}{8}=\black{129} |
| 316 |
\pos{m}{9}=\white{114} |
| 317 |
\pos{m}{10}=\black{125} |
| 318 |
\pos{m}{12}=\black{145} |
| 319 |
\pos{m}{16}=\white{124} |
| 320 |
\pos{m}{17}=\white{122} |
| 321 |
% |
| 322 |
\pos{n}{7}=\black{113} |
| 323 |
\pos{n}{9}=\black{159} |
| 324 |
\pos{n}{10}=\black{167} |
| 325 |
\pos{n}{11}=\white{164} |
| 326 |
% |
| 327 |
\pos{o}{2}=\black{131} |
| 328 |
\pos{o}{4}=\black{7} |
| 329 |
\pos{o}{9}=\black{153} |
| 330 |
\pos{o}{12}=\white{156} |
| 331 |
\pos{o}{16}=\white{28} |
| 332 |
% |
| 333 |
\pos{p}{1}=\white{130} |
| 334 |
\pos{p}{2}=\black{111} |
| 335 |
\pos{p}{6}=\black{85} |
| 336 |
\pos{p}{8}=\white{152} |
| 337 |
\pos{p}{9}=\black{151} |
| 338 |
\pos{p}{11}=\white{162} |
| 339 |
\pos{p}{12}=\black{155} |
| 340 |
\pos{p}{13}=\white{104} |
| 341 |
\pos{p}{14}=\white{108} |
| 342 |
\pos{p}{15}=\white{26} |
| 343 |
\pos{p}{16}=\black{25} |
| 344 |
\pos{p}{17}=\white{106} |
| 345 |
\pos{p}{18}=\white{34} |
| 346 |
% |
| 347 |
\pos{q}{2}=\white{110} |
| 348 |
\pos{q}{3}=\black{45} |
| 349 |
\pos{q}{4}=\black{1} |
| 350 |
\pos{q}{7}=\black{103} |
| 351 |
\pos{q}{8}=\white{150} |
| 352 |
\pos{q}{9}=\black{149} |
| 353 |
\pos{q}{10}=\white{8} |
| 354 |
\pos{q}{11}=\black{161} |
| 355 |
\pos{q}{12}=\white{100} |
| 356 |
\pos{q}{13}=\black{101} |
| 357 |
\pos{q}{14}=\black{107} |
| 358 |
\pos{q}{15}=\white{30} |
| 359 |
\pos{q}{16}=\black{29} |
| 360 |
\pos{q}{17}=\white{36} |
| 361 |
% |
| 362 |
\pos{r}{1}=\white{112} |
| 363 |
\pos{r}{2}=\black{47} |
| 364 |
\pos{r}{3}=\white{42} |
| 365 |
\pos{r}{4}=\black{43} |
| 366 |
\pos{r}{6}=\white{6} |
| 367 |
\pos{r}{7}=\black{99} |
| 368 |
\pos{r}{8}=\white{146} |
| 369 |
\pos{r}{9}=\black{97} |
| 370 |
\pos{r}{11}=\white{40} |
| 371 |
\pos{r}{12}=\black{39} |
| 372 |
\pos{r}{15}=\black{31} |
| 373 |
\pos{r}{16}=\white{4} |
| 374 |
\pos{r}{17}=\black{27} |
| 375 |
\pos{r}{18}=\white{96} |
| 376 |
% |
| 377 |
\pos{s}{2}=\white{46} |
| 378 |
\pos{s}{3}=\white{48} |
| 379 |
\pos{s}{4}=\white{44} |
| 380 |
\pos{s}{7}=\white{102} |
| 381 |
\pos{s}{8}=\white{126} |
| 382 |
\pos{s}{9}=\black{185} |
| 383 |
\pos{s}{11}=\white{98} |
| 384 |
\pos{s}{12}=\black{41} |
| 385 |
\pos{s}{13}=\black{109} |
| 386 |
\pos{s}{15}=\black{35} |
| 387 |
\pos{s}{16}=\white{32} |
| 388 |
\pos{s}{17}=\black{33} |
| 389 |
% |
| 390 |
\pos{t}{16}=\black{37} |
| 391 |
|
| 392 |
\begin{figure}[htb] |
| 393 |
\gofontsize{15} |
| 394 |
$$ |
| 395 |
\showfulldiagram |
| 396 |
$$ |
| 397 |
\begin{center} Dia. 3 \end{center} |
| 398 |
\end{figure} |
| 399 |
|
| 400 |
\noindent |
| 401 |
Diagrams are put in a text like ordinary vboxes. |
| 402 |
|
| 403 |
The stones can be also put directly in a paragraph. To do this |
| 404 |
you should use the \verb+\textwhite+ and \verb+\textblack+ |
| 405 |
commands instead of \verb+\white+ and \verb+\black+. For |
| 406 |
example, the sentence from the beginning of this article: |
| 407 |
``\textblack{1} is the first stone played, \textwhite{2} the |
| 408 |
second, and so on'' was written as: ``\verb+\textblack{1}+ is the |
| 409 |
first stone played, \verb+\textwhite{2}+ the second, and so on.'' |
| 410 |
|
| 411 |
There are no other secrets in coding go diagrams. Macros for |
| 412 |
making $9\times 9$ or $13 \times 13$ diagrams can easily be |
| 413 |
added to `go.sty' by a simple modification of the existing |
| 414 |
macros for $19 \times 19$ diagrams. |
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
\subsection*{References} |
| 419 |
|
| 420 |
\begin{itemize} |
| 421 |
\item[{[1]}] Zalman Rubinstein: ``Chess printing via Metafont |
| 422 |
and \TeX'', TUGboat Vol.~10, No.~2. |
| 423 |
\item[{[2]}] Iwamoto Kaoru, 9 dan: ``Go for beginners'', Ishi |
| 424 |
Press, Inc., Tokyo, Japan. |
| 425 |
\item[{[3]}] Janusz Kraszek: ``\'Swiat Go'', COK, Warsaw 1989 |
| 426 |
(in Polish). |
| 427 |
\end{itemize} |
| 428 |
|
| 429 |
\end{document} |