blob: 296b3afcc39665c95c47c3743472ed6bc03106a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
%%%%%%%%%%%%%%%%%%%%%%%% othello.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Othello package written by Michiel le Comte michiel.le.comte@zonnet.nl
% This package has been created using (mutilating?) the Go package written by
% Hanna Kolodziejska (version 0.05 : November 1991) as basis
% Remark: if someone can fix a switch in the pos thingie, please notify me.
% A nicer metafont definition for the letter X and C (ot1neu.mf, digit[10] and
% digit[11]) is also welcome.
%
% For a short introduction how to use this package, look at the othello.tex file,
% it contains a short manual at the end.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\catcode`@=11
\newbox\@gobox \newdimen\@godimen
\def\gofontsize#1{
\font\gofont=ot#1 at #1truept
\font\blackfontOne=ot1bla#1 at #1truept
\font\whitefontOne=ot1whi#1 at #1truept
\font\neutralfontOne=ot1neu#1 at #1truept
\ifnum #1=10 \font\letterfont=cmr10 at 10truept\else
\ifnum #1=15 \font\letterfont=cmr10 at 14.4truept\else
\ifnum #1=20 \font\letterfont=cmr10 at 17.28truept\fi\fi\fi
\setbox\@gobox=\hbox{\gofont\char0}
\@godimen=\wd\@gobox
}
\gofontsize{10} % initialization <---
\def\newgoline{\hfill\break}
\def\empty{\gofont\char1}
\def\lftborder{\gofont\char2}
\def\rtborder{\gofont\char3}
\def\topborder{\gofont\char4}
\def\botborder{\gofont\char5}
\def\lfttopcorner{\gofont\char6}
\def\rttopcorner{\gofont\char7}
\def\lftbotcorner{\gofont\char8}
\def\rtbotcorner{\gofont\char9}
\newcount\n
\newcount\@beglet \newcount\@endlet
\newcount\@lettercount
\def\@letternumber#1{\relax
\ifx #1a\@lettercount=1\else
\ifx #1b\@lettercount=2\else
\ifx #1c\@lettercount=3\else
\ifx #1d\@lettercount=4\else
\ifx #1e\@lettercount=5\else
\ifx #1f\@lettercount=6\else
\ifx #1g\@lettercount=7\else
\ifx #1h\@lettercount=8\else
\ifx #1i\@lettercount=9\else
\errmessage{Row label must be letter!}
\fi\fi\fi\fi\fi\fi\fi\fi\fi
}
\def\inidiagram#1-#2:#3-#4 {\relax
\ifnum #3>#4 \errmessage{Invalid column numbers!} \fi
\@letternumber{#1} \@beglet=\@lettercount
\@letternumber{#2} \@endlet=\@lettercount
\def\@inirow##1##2{{\n=#3
\loop
\expandafter\let\csname @##1\romannumeral\n \endcsname=0\relax
\edef\@@inirow{\global
\def\csname @##1\romannumeral\n \endcsname{##2}}\@@inirow
\ifnum \n<#4 \advance \n by 1
\repeat
}}\relax
\loop
\ifcase\@beglet\relax\or
\@inirow{a}{\topborder}\relax
\ifnum #3=1 \global\def\@ai{\lfttopcorner}\fi
\ifnum #4=9 \global\def\@aix{\rttopcorner}\fi \or
\@inirow{b}{\empty}\relax
\ifnum #3=1 \global\def\@bi{\lftborder}\fi
\ifnum #4=9 \global\def\@bix{\rtborder}\fi \or
\@inirow{c}{\empty}\relax
\ifnum #3=1 \global\def\@ci{\lftborder}\fi
\ifnum #4=9 \global\def\@cix{\rtborder}\fi \or
\@inirow{d}{\empty}\relax
\ifnum #3=1 \global\def\@di{\lftborder}\fi
\ifnum #4=9 \global\def\@dix{\rtborder}\fi \or
\@inirow{e}{\empty}
\ifnum #3=1 \global\def\@ei{\lftborder}\fi
\ifnum #4=9 \global\def\@eix{\rtborder}\fi \or
\@inirow{f}{\empty}
\ifnum #3=1 \global\def\@fi{\lftborder}\fi
\ifnum #4=9 \global\def\@fix{\rtborder}\fi \or
\@inirow{g}{\empty}
\ifnum #3=1 \global\def\@gi{\lftborder}\fi
\ifnum #4=9 \global\def\@gix{\rtborder}\fi \or
\@inirow{h}{\empty}
\ifnum #3=1 \global\def\@hi{\lftborder}\fi
\ifnum #4=9 \global\def\@hix{\rtborder}\fi \or
\@inirow{i}{\botborder}
\ifnum #3=1 \global\def\@ii{\lftbotcorner}\fi
\ifnum #4=9 \global\def\@iix{\rtbotcorner}\fi
\fi
\ifnum \@beglet<\@endlet \advance \@beglet by 1
\repeat
}
\def\inifulldiagram{\inidiagram a-i:1-9 }
\inifulldiagram % initialization
\def\showdiagram#1-#2:#3-#4 {\vbox{\offinterlineskip\noindent
\ifnum #3>#4 \errmessage{Invalid column numbers!} \fi
\hsize=\@godimen
\n=#4\advance\n by-#3\advance\n by1
\multiply\hsize by\n
\@letternumber{#1} \@beglet=\@lettercount
\@letternumber{#2} \@endlet=\@lettercount
\def\@showrow##1{{\n=#3
\loop
\edef\@@showrow{\csname @##1\romannumeral\n \endcsname}\@@showrow
\ifnum \n<#4 \advance \n by 1
\repeat
}}\relax
\loop
\ifcase\@beglet\relax\or
\@showrow{a}\or
\@showrow{b}\or
\@showrow{c}\or
\@showrow{d}\or
\@showrow{e}\or
\@showrow{f}\or
\@showrow{g}\or
\@showrow{h}\or
\@showrow{i}
\fi
\ifnum \@beglet<\@endlet
\newgoline \advance \@beglet by 1
\repeat
}}
\def\showfulldiagram{\showdiagram a-i:1-9 }
\def\pos#1#2=#3#4{\relax
\ifcat #1a\relax \else \errmessage{Row label must be a letter!}\fi
\ifnum #2<1 \errmessage{Column number less than 1?}\fi
\ifnum #2>9 \errmessage{Column number greater than 9?}\fi
\edef\@fourth{#4}\relax
\ifx .#4\ifx #3\empty\edef\@fourth{}\else \edef\@fourth{0}\fi\fi
\edef\@borders{\relax
\ifx #1a \ifnum #2=1 \gofont\char6 \else
\ifnum #2=9 \gofont\char7 \else
\gofont\topborder
\fi\fi
\else
\ifx #1i \ifnum #2=1 \gofont\char17 \else
\ifnum #2=9 \gofont\char18 \else
\gofont\char14 \fi\fi
\else
\ifnum #2=1 \lftborder
\else
\ifnum #2=9 \gofont\char12
\else
\gofont\char1
\fi\fi\fi\fi
}\relax
\expandafter\let\csname @#1\romannumeral#2\endcsname=0\relax
\edef\@pos{\def\csname @#1\romannumeral#2\endcsname{#3{\@fourth}}}\@pos
\ignorespaces
}
\newcount\nr
\def\black#1{\relax
\ifx \triangle#1{\rlap{\triangle}\@borders}\else
\ifx \square#1{\rlap{\square}\@borders}\else
\ifnum #1<0 \errmessage{Negative White's move?}\else
\ifnum #1>64 \errmessage{White's move too big!}\else
\ifnum #1<65 {\blackfontOne\rlap{\char#1}\@borders}\fi\fi\fi\fi\fi}
\def\white#1{\relax
\ifx \triangle#1{\rlap{\triangle}\@borders}\else
\ifx \square#1{\rlap{\square}\@borders}\else
\ifnum #1<0 \errmessage{Negative White's move?}\else
\ifnum #1>64 \errmessage{White's move too big!}\else
\ifnum #1<65 {\whitefontOne\rlap{\char#1}\@borders}\fi\fi\fi\fi\fi}
\def\neutral#1{\relax
\ifx \triangle#1{\rlap{\triangle}\@borders}\else
\ifx \square#1{\rlap{\square}\@borders}\else
\ifnum #1<0 \errmessage{A negative move?}\else
\ifnum #1>66 \errmessage{There are only 64 moves to make!}\else
\ifnum #1<67 {\neutralfontOne\rlap{\char#1}\@borders}\fi\fi\fi\fi\fi}
\def\textblack#1{\def\@borders{\hskip\wd\@gobox}\relax
\ifx .#1\lower.2\wd\@gobox\hbox{\black{0}}\else
\lower.2\wd\@gobox\hbox{\black{#1}}\fi}
\def\textwhite#1{\def\@borders{\hskip\wd\@gobox}\relax
\ifx .#1\lower.2\wd\@gobox\hbox{\white{0}}\else
\lower.2\wd\@gobox\hbox{\white{#1}}\fi}
\newbox\@letterbox \newdimen\@letterdim
\catcode`@=12
|