Debian Codegraph @

texmf-dist/doc/latex/othelloboard/othelloboard.tex

raw
1 \documentclass[a4paper,12pt]{article}
2
3 \pagestyle{plain}
4 \usepackage{fullpage}
5 \usepackage{moreverb}
6 \usepackage{wrapfig}
7 \usepackage{multicol}
8 \usepackage{appendix}
9 \usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent
10 \usepackage{othelloboard}
11 \usepackage{hyperref}
12 %\usepackage{natbib}
13
14
15 %%% TITLE %%%
16 \newcommand{\fileversion}{v1.2}
17 \title{The \textsf{othelloboard} package%
18 \thanks{This document corresponds to \textsf{othelloboard}~\fileversion. Thanks to Brian Rose for permission to typeset material from his book for the example file: \texttt{example-rose-chps1-2.pdf}.}
19 }\author{Steven Hall \\ \texttt{[email protected]}}
20 \date{18 August 2011}
21
22
23 %% DOCUMENT %%
24
25 \begin{document}
26 \pagestyle{plain}
27
28 \maketitle
29 \tableofcontents
30
31 %------
32 \section{Drawing a simple board diagram}
33 \begin{center}
34 \begin{othelloboard}{1}
35 \gridrefs
36 \dotmarkings
37 \othelloarrayfirstrow {0}{0}{0}{0}{0}{0}{0}{0}
38 \othelloarraysecondrow {0}{0}{2}{0}{0}{0}{0}{0}
39 \othelloarraythirdrow {0}{1}{2}{2}{2}{0}{0}{0}
40 \othelloarrayfourthrow {0}{1}{2}{1}{2}{1}{0}{0}
41 \othelloarrayfifthrow {0}{0}{2}{2}{1}{1}{0}{0}
42 \othelloarraysixthrow {0}{0}{2}{1}{1}{1}{0}{0}
43 \othelloarrayseventhrow {0}{0}{0}{0}{0}{0}{0}{0}
44 \othelloarrayeighthrow {0}{0}{0}{0}{0}{0}{0}{0}
45 \end{othelloboard}
46 \end{center}
47
48 The board above was produced by the following list of commands:
49 \begin{verbatimtab}
50 \begin{othelloboard}{1}
51 \dotmarkings
52 \othelloarrayfirstrow {0}{0}{0}{0}{0}{0}{0}{0}
53 \othelloarraysecondrow {0}{0}{2}{0}{0}{0}{0}{0}
54 \othelloarraythirdrow {0}{1}{2}{2}{2}{0}{0}{0}
55 \othelloarrayfourthrow {0}{1}{2}{1}{2}{1}{0}{0}
56 \othelloarrayfifthrow {0}{0}{2}{2}{1}{1}{0}{0}
57 \othelloarraysixthrow {0}{0}{2}{1}{1}{1}{0}{0}
58 \othelloarrayseventhrow {0}{0}{0}{0}{0}{0}{0}{0}
59 \othelloarrayeighthrow {0}{0}{0}{0}{0}{0}{0}{0}
60 \end{othelloboard}
61 \end{verbatimtab}
62
63 Try copying this block of code into your own document and typesetting it. Make sure you include \verb=\usepackage{othelloboard}= somewhere in your preamble.
64
65 Try replacing any of the \verb=0=s, \verb=1=s and \verb=2=s in the array with any number \verb=0=--\verb=4=. You should see that each number has the following effect (\verb=0= has no effect):
66
67 \label{disckey}~\begin{tabular}{l c l l c l}
68 \verb=1= & draws a white disc: & \begin{picture}(20,20) \put(10,5){\circle{20}} \end{picture} & \hspace{24pt} \verb=3= & draws a white diamond: & \begin{picture}(20,20) \put(10,5){\whitediamond} \end{picture} \\
69 \verb=2= & draws a black disc: & \begin{picture}(20,20) \put(10,5){\circle*{20}} \end{picture} & \hspace{24pt} \verb=4= & draws a black diamond: & \begin{picture}(20,20) \put(10,5){\blackdiamond} \end{picture} \\
70 \end{tabular}\\
71
72 You should also see that where you choose to put a number in the grid determines where on the Othello board it appears. The \textsf{othelloboard} package has been designed to make creating a board diagram as intuitive and simple as possible, so the position of numbers in the array corresponds to exactly the squares you would expect in the diagram. Changing the `\verb=2=' to a `\verb=1=' e.g.\ in the second row of numbers in the code replaces the black disc on c2 with a white one.
73
74 \subsection{The \texttt{othelloboard} environment}
75 \subsubsection{The basic commands}
76
77 Look again at the opening and closing lines of code for the diagram in the previous section.
78
79 \begin{description}
80 \item{\verb=\begin{othelloboard}{1}=} \verb=% = Mandatory argument for board size.
81 \item \ldots
82 \item{\verb=\end{othelloboard}=}
83 \end{description}
84
85 The board diagram was created by entering a series of commands inside of an \verb=othelloboard= environment. The mandatory argument at the end of the \verb=\begin= environment declaration specifies the size of board. Any size at all is possible without loss of detail in the diagram. The board diagram above was set with default value of 1. A value between 0 and 1 produces a smaller board, while a value greater than 1 produces a larger board.
86
87 \begin{description}
88 \item{\verb=\dotmarkings=} produces the tiny marker dots on the inside corners of the X-squares. The command can be deleted or commented out if you don't want the dots.
89 \end{description}
90
91 Next, the array of discs on the board is drawn by eight separate commands, one for each row. E.g.\ row three is drawn by this command:
92 \begin{description}
93 \item{\verb=\othelloarraythirdrow{0}{1}{2}{2}{2}{0}{0}{0}=} The command takes eight arguments, one for each square on the third row, a3--h3. The possible values of each argument are \verb=0=, \verb=1=, \verb=2=, \verb=3=, \verb=4= (with effects described at the top of this page).
94 \end{description}
95
96 If you don't wish to draw any discs at all for a particular row, it is not necessary to include the command for that row. We could easily, e.g., have omitted the first and eighth row commands in our diagram in the previous section (rather than give the command with a just series of \verb=0=s as arguments).
97
98 Here is a board drawn at size 0.75 without \verb=\dotmarkings=, and with the \verb=\othelloarray=\ldots\verb=row= commands for the first and eighth rows omitted:\\
99 \begin{tabular}{ll}
100 \begin{othelloboard}{0.75}
101 \othelloarrayfirstrow {0}{0}{0}{0}{0}{0}{0}{0}
102 \othelloarraysecondrow {0}{0}{2}{0}{0}{0}{0}{0}
103 \othelloarraythirdrow {0}{1}{2}{2}{2}{0}{0}{0}
104 \othelloarrayfourthrow {0}{1}{2}{1}{2}{1}{0}{0}
105 \othelloarrayfifthrow {0}{0}{2}{2}{4}{1}{0}{0}
106 \othelloarraysixthrow {0}{0}{2}{4}{4}{1}{0}{0}
107 \othelloarrayseventhrow {0}{0}{0}{0}{2}{0}{0}{0}
108 \othelloarrayeighthrow {0}{0}{0}{0}{0}{0}{0}{0}
109 \end{othelloboard}
110 &
111 \begin{minipage}[b]{320pt}
112 \begin{verbatimtab}
113 \begin{othelloboard}{0.75}
114 \othelloarraysecondrow {0}{0}{2}{0}{0}{0}{0}{0}
115 \othelloarraythirdrow {0}{1}{2}{2}{2}{0}{0}{0}
116 \othelloarrayfourthrow {0}{1}{2}{1}{2}{1}{0}{0}
117 \othelloarrayfifthrow {0}{0}{2}{2}{4}{1}{0}{0}
118 \othelloarraysixthrow {0}{0}{2}{4}{4}{1}{0}{0}
119 \othelloarrayseventhrow {0}{0}{0}{0}{2}{0}{0}{0}
120 \end{othelloboard}
121 \end{verbatimtab}
122 \ \\
123 \end{minipage}\\
124 \end{tabular}
125 \ \\
126 Note the use of black diamonds to show the discs just flipped by the black disc placed at e7. This is the convention followed, e.g., in Brian Rose's book (Rose 2005).
127
128 \paragraph{Useful tip}\label{tabtips}
129 You may find that it helps see where you are putting discs if you align all of the rows of numbers in the array. You can do this (as with the examples given in this document) by putting tabs between the command name and its first argument. Don't use spaces though, as unlike tabs (which aren't read as gaps when the file compiles), spaces will break the commands and cause errors.
130
131 \verb=\othelloarrayfirstrow= \begin{picture}(30,30)\put(20,8){\vector(-1,-2){5}}\put(0,12){\textit{tabs not spaces}}\end{picture}\verb= {0}{1}{1}{2}{1}{0}{0}{0}=\\
132
133 \subsection{The \texttt{othelloboardnorefs} environment}
134 \label{norefs}
135 If you don't want grid reference labels along the top and left edges, you can use the \verb=othelloboardnorefs= environment instead of the \verb=othelloboard= environment. The commands that work inside of the environment are all the same as before, but the outside boundaries of the diagram will be the edges of the 8$\times$8 grid. Our opening example, changing only the environment, gives this output:
136
137 \begin{minipage}[t]{196pt}
138 \vspace{0pt}
139 \begin{othelloboardnorefs}{1}
140 \dotmarkings
141 \othelloarrayfirstrow {0}{0}{0}{0}{0}{0}{0}{0}
142 \othelloarraysecondrow {0}{0}{2}{0}{0}{0}{0}{0}
143 \othelloarraythirdrow {0}{1}{2}{2}{2}{0}{0}{0}
144 \othelloarrayfourthrow {0}{1}{2}{1}{2}{1}{0}{0}
145 \othelloarrayfifthrow {0}{0}{2}{2}{1}{1}{0}{0}
146 \othelloarraysixthrow {0}{0}{2}{1}{1}{1}{0}{0}
147 \othelloarrayseventhrow {0}{0}{0}{0}{0}{0}{0}{0}
148 \othelloarrayeighthrow {0}{0}{0}{0}{0}{0}{0}{0}
149 \end{othelloboardnorefs}
150 \end{minipage}
151 \begin{minipage}[t]{360pt}
152 \vspace{12pt}
153 \begin{small}
154 \begin{verbatimtab}
155 \begin{othelloboardnorefs}{1}
156 \dotmarkings
157 \othelloarrayfirstrow {0}{0}{0}{0}{0}{0}{0}{0}
158 \othelloarraysecondrow {0}{0}{2}{0}{0}{0}{0}{0}
159 \othelloarraythirdrow {0}{1}{2}{2}{2}{0}{0}{0}
160 \othelloarrayfourthrow {0}{1}{2}{1}{2}{1}{0}{0}
161 \othelloarrayfifthrow {0}{0}{2}{2}{1}{1}{0}{0}
162 \othelloarraysixthrow {0}{0}{2}{1}{1}{1}{0}{0}
163 \othelloarrayseventhrow {0}{0}{0}{0}{0}{0}{0}{0}
164 \othelloarrayeighthrow {0}{0}{0}{0}{0}{0}{0}{0}
165 \end{othelloboardnorefs}
166 \end{verbatimtab}
167 \end{small}
168 \end{minipage}
169
170 A standard-size \verb=othelloboard= diagram produces a 208pt$\times$208pt box containing a 192pt$\times$192pt board with grid labels in 16pt margins at the top and left side. A standard-size \verb=othelloboardnorefs= diagram produces a 192pt$\times$192pt box containing just the board (see Appendix \ref{appendix:layout}).
171
172 \section{Annotations}
173 You may want to add some annotations to some of the squares, perhaps for move numbers or to indicate possible moves at a particular point in a game.\\
174 \begin{minipage}[t]{212pt}
175 \vspace{0pt}
176 \begin{othelloboard}{1}
177 \dotmarkings
178 \othelloarrayfirstrow {0}{0}{0}{0}{0}{0}{0}{0}
179 \othelloarraysecondrow {0}{0}{2}{0}{0}{0}{0}{0}
180 \othelloarraythirdrow {0}{1}{2}{2}{2}{0}{0}{0}
181 \othelloarrayfourthrow {0}{1}{2}{1}{2}{1}{0}{0}
182 \othelloarrayfifthrow {0}{0}{2}{2}{2}{1}{0}{0}
183 \othelloarraysixthrow {0}{0}{2}{2}{2}{1}{0}{0}
184 \othelloarrayseventhrow {0}{0}{0}{0}{2}{0}{0}{0}
185 \othelloarrayeighthrow {0}{0}{0}{0}{0}{0}{0}{0}
186 %annotations
187 \annotationsfirstrow {} {} {} {} {} {} {} {}
188 \annotationssecondrow {} {} {9} {} {} {} {} {}
189 \annotationsthirdrow {} {8} {5} {4} {11} {} {} {}
190 \annotationsfourthrow {} {10} {3} {} {} {6} {} {}
191 \annotationsfifthrow {} {} {7} {} {} {1} {} {}
192 \annotationssixthrow {} {} {13} {2} {12} {14} {} {}
193 \annotationsseventhrow {} {} {} {} {15} {} {} {}
194 \annotationseighthrow {} {} {} {} {} {} {} {}
195 \end{othelloboard}
196 \end{minipage}
197 \begin{minipage}[t]{248pt}
198 \vspace{8pt}
199 \begin{footnotesize}
200 \begin{verbatimtab}
201 \begin{othelloboard}{1}
202 \dotmarkings
203 \othelloarraysecondrow {0}{0}{2}{0}{0}{0}{0}{0}
204 \othelloarraythirdrow {0}{1}{2}{2}{2}{0}{0}{0}
205 \othelloarrayfourthrow {0}{1}{2}{1}{2}{1}{0}{0}
206 \othelloarrayfifthrow {0}{0}{2}{2}{2}{1}{0}{0}
207 \othelloarraysixthrow {0}{0}{2}{2}{2}{1}{0}{0}
208 \othelloarrayseventhrow {0}{0}{0}{0}{2}{0}{0}{0}
209 %annotations
210 \annotationssecondrow {} {} {9}{} {} {} {} {}
211 \annotationsthirdrow {}{8}{5}{4}{11}{} {} {}
212 \annotationsfourthrow {}{10}{3}{} {} {6}{} {}
213 \annotationsfifthrow {} {} {7}{} {} {1}{} {}
214 \annotationssixthrow {}{}{13}{2}{12}{14}{}{}
215 \annotationsseventhrow {} {} {} {}{15}{} {} {}
216 \end{othelloboard}
217 \end{verbatimtab}
218 \end{footnotesize}
219 \end{minipage}
220 \ \\
221 \noindent \begin{minipage}[t]{212pt}
222 \vspace{0pt}
223 \begin{othelloboard}{1}
224 \dotmarkings
225 \othelloarrayfirstrow {0}{0}{0}{0}{0}{0}{0}{0}
226 \othelloarraysecondrow {0}{0}{2}{0}{0}{0}{0}{0}
227 \othelloarraythirdrow {0}{1}{2}{2}{2}{0}{0}{0}
228 \othelloarrayfourthrow {0}{1}{2}{1}{2}{1}{0}{0}
229 \othelloarrayfifthrow {0}{0}{2}{2}{1}{1}{0}{0}
230 \othelloarraysixthrow {0}{0}{2}{1}{1}{1}{0}{0}
231 \othelloarrayseventhrow {0}{0}{0}{0}{0}{0}{0}{0}
232 \othelloarrayeighthrow {0}{0}{0}{0}{0}{0}{0}{0}
233 %annotations
234 \annotationssecondrow {} {} {} {} {} {} {} {}
235 \annotationsthirdrow {} {} {} {} {} {} {} {}
236 \annotationsfourthrow {} {} {} {} {} {} {} {}
237 \annotationsfifthrow {c} {} {} {} {} {} {} {}
238 \annotationssixthrow {} {} {} {} {} {} {} {}
239 \annotationsseventhrow {} {} {} {b} {a?} {} {} {}
240 \end{othelloboard}
241 \end{minipage}
242 \begin{minipage}[t]{248pt}
243 \vspace{8pt}
244 \begin{footnotesize}
245 \begin{verbatimtab}
246 \begin{othelloboard}{1}
247 \dotmarkings
248 \othelloarraysecondrow {0}{0}{2}{0}{0}{0}{0}{0}
249 \othelloarraythirdrow {0}{1}{2}{2}{2}{0}{0}{0}
250 \othelloarrayfourthrow {0}{1}{2}{1}{2}{1}{0}{0}
251 \othelloarrayfifthrow {0}{0}{2}{2}{1}{1}{0}{0}
252 \othelloarraysixthrow {0}{0}{2}{1}{1}{1}{0}{0}
253 %annotations
254 \annotationssecondrow {} {} {} {} {} {} {} {}
255 \annotationsthirdrow {} {} {} {} {} {} {} {}
256 \annotationsfourthrow {} {} {} {} {} {} {} {}
257 \annotationsfifthrow {c}{} {} {} {} {} {} {}
258 \annotationssixthrow {} {} {} {} {} {} {} {}
259 \annotationsseventhrow {} {} {}{b}{a?}{} {} {}
260 \end{othelloboard}
261 \end{verbatimtab}
262 \end{footnotesize}
263 \end{minipage}
264 \ \\
265
266 A row of annotations is added with an \verb=\annotations=\ldots\ command. Again, there is one for each row, each taking eight arguments. Here is a possible instance of the command for adding annotations to the fifth row:
267
268 \begin{description}
269 \item{\verb=\annotationsfifthrow{}{43}{17}{}{}{a}{b?}{??}=} The command has an argument place for each of the squares a5--h5. The command simply prints the value of each argument, centred at the corresponding square. Any string is possible as an argument (including use of symbols in \verb=mathmode=), though you will probably only want to use one- or two-digit numerals or single letters (as in both of the diagrams just given). To leave a square unannotated, put nothing -- \verb={}= -- between the braces; putting zero -- \verb={0}= -- prints a \verb=0=.
270 \end{description}
271
272 To annotate a diagram just add the corresponding annotation command for each row you want to annotate. Make sure that the \verb=\annotations=\ldots\ commands appear \emph{below} the \verb=\othelloarray=\ldots\ commands.
273
274 \paragraph{Text colour}
275 You do not have to specify the colour of annotation text, since the \textsf{othelloboard} package is smart enough to work out the colour of the disc (or diamond) underneath the text on the same square. Annotations on a black shape are automatically set in white; other annotations are set in the default text colour (black), including those on empty squares.
276
277 \subsection{Placing an individual annotation at a specified square}
278
279 It is also possible to place an individual annotation at a specific square by giving the square name. The command for this is:
280
281 \verb=\posannotation{<=\emph{squarename}\verb=>}{<=\emph{annotationstring}\verb=>}=
282
283 So \verb=\posannotation{F2}{47}= puts the numeral `47' at square f2.
284
285
286 \subsection{Transcripts}
287 Using \verb=\annotations=\ldots\ together with \verb=\othelloarray=\ldots\ commands, it is thus possible to set any transcript in the two standard styles: \\
288
289 \noindent \begin{picture}(216,220)(12,-16)
290 \begin{othelloboard}{1}
291 \othelloarrayfirstrow {1}{2}{1}{1}{2}{1}{2}{1}
292 \othelloarraysecondrow {2}{1}{2}{2}{2}{1}{2}{2}
293 \othelloarraythirdrow {2}{2}{2}{1}{2}{1}{1}{1}
294 \othelloarrayfourthrow {1}{1}{2}{1}{2}{1}{2}{2}
295 \othelloarrayfifthrow {2}{1}{1}{2}{1}{2}{2}{1}
296 \othelloarraysixthrow {1}{2}{2}{1}{2}{2}{1}{1}
297 \othelloarrayseventhrow {2}{1}{1}{2}{1}{1}{2}{2}
298 \othelloarrayeighthrow {2}{1}{2}{2}{1}{1}{2}{1}
299 \annotationsfirstrow {54} {51} {34} {30} {31} {32} {41} {42}
300 \annotationssecondrow {55} {50} {43} {33} {29} {28} {39} {58}
301 \annotationsthirdrow {23} {27} {3} {4} {25} {8} {40} {59}
302 \annotationsfourthrow {24} {22} {5} {} {} {6} {37} {60}
303 \annotationsfifthrow {47} {20} {14} {} {} {1} {35} {38}
304 \annotationssixthrow {26} {21} {15} {2} {9} {7} {12} {36}
305 \annotationsseventhrow {49} {56} {16} {11} {10} {18} {45} {53}
306 \annotationseighthrow {57} {46} {17} {13} {44} {52} {19} {48}
307 %\put(12,-14){Figure 3.2}
308 \end{othelloboard}
309 \end{picture}
310 \begin{minipage}[b]{320pt}
311 \begin{footnotesize}
312 \begin{verbatimtab}
313 \begin{othelloboard}{1}
314 \othelloarrayfirstrow {1}{2}{1}{1}{2}{1}{2}{1}
315 \othelloarraysecondrow {2}{1}{2}{2}{2}{1}{2}{2}
316 \othelloarraythirdrow {2}{2}{2}{1}{2}{1}{1}{1}
317 \othelloarrayfourthrow {1}{1}{2}{1}{2}{1}{2}{2}
318 \othelloarrayfifthrow {2}{1}{1}{2}{1}{2}{2}{1}
319 \othelloarraysixthrow {1}{2}{2}{1}{2}{2}{1}{1}
320 \othelloarrayseventhrow {2}{1}{1}{2}{1}{1}{2}{2}
321 \othelloarrayeighthrow {2}{1}{2}{2}{1}{1}{2}{1}
322 %annotations
323 \annotationsfirstrow {54}{51}{34}{30}{31}{32}{41}{42}
324 \annotationssecondrow {55}{50}{43}{33}{29}{28}{39}{58}
325 \annotationsthirdrow {23}{27}{3} {4} {25} {8}{40}{59}
326 \annotationsfourthrow {24}{22}{5} {} {} {6}{37}{60}
327 \annotationsfifthrow {47}{20}{14} {} {} {1}{35}{38}
328 \annotationssixthrow {26}{21}{15} {2} {9} {7}{12}{36}
329 \annotationsseventhrow {49}{56}{16}{11}{10}{18}{45}{53}
330 \annotationseighthrow {57}{46}{17}{13}{44}{52}{19}{48}
331 \end{othelloboard}
332 \end{verbatimtab}
333 \end{footnotesize}
334 \end{minipage}
335
336 \noindent \begin{picture}(216,220)(12,-16)
337 \begin{othelloboard}{1}
338 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
339 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
340 \annotationsfirstrow {54} {51} {34} {30} {31} {32} {41} {42}
341 \annotationssecondrow {55} {50} {43} {33} {29} {28} {39} {58}
342 \annotationsthirdrow {23} {27} {3} {4} {25} {8} {40} {59}
343 \annotationsfourthrow {24} {22} {5} {} {} {6} {37} {60}
344 \annotationsfifthrow {47} {20} {14} {} {} {1} {35} {38}
345 \annotationssixthrow {26} {21} {15} {2} {9} {7} {12} {36}
346 \annotationsseventhrow {49} {56} {16} {11} {10} {18} {45} {53}
347 \annotationseighthrow {57} {46} {17} {13} {44} {52} {19} {48}
348 %\put(12,-14){Figure 3.3 \label{Figure 3.3}}
349 \end{othelloboard}
350 \end{picture}
351 \begin{minipage}[b]{248pt}
352 \begin{footnotesize}
353 \begin{verbatimtab}
354 \begin{othelloboard}{1}
355 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
356 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
357 %annotations
358 \annotationsfirstrow {54}{51}{34}{30}{31}{32}{41}{42}
359 \annotationssecondrow {55}{50}{43}{33}{29}{28}{39}{58}
360 \annotationsthirdrow {23}{27}{3} {4} {25} {8}{40}{59}
361 \annotationsfourthrow {24}{22}{5} {} {} {6}{37}{60}
362 \annotationsfifthrow {47}{20}{14} {} {} {1}{35}{38}
363 \annotationssixthrow {26}{21}{15} {2} {9} {7}{12}{36}
364 \annotationsseventhrow {49}{56}{16}{11}{10}{18}{45}{53}
365 \annotationseighthrow {57}{46}{17}{13}{44}{52}{19}{48}
366 \end{othelloboard}
367 \end{verbatimtab}
368 \end{footnotesize}
369 \ \\
370 \ \\
371 \end{minipage}
372
373 \section{Automated methods for board creation}
374
375 In addition to the manual row-by-row methods described in previous sections for creating board diagrams, \textsf{othelloboard} also supports the automated creation of board diagrams and transcripts from long strings of text in a standard format used by Othello software such as WZebra and Cassio.
376
377 \subsection{Drawing a transcript from a list of moves}
378
379 It is common practice to give a game transcript as a single long alphanumeric string. Here's an example exported from Cassio:
380
381 C4C3D3C5B4D2D6C6E6F4B3B5F3F5G3G4A5A6C2A4A3B6E1C1A7F2C7C8D7F6G6F7
382 E2D1E8F8D8E7G5H3F1H6E3G1B2B1H4A1A2A8H5B7B8G2H7H8G8G7H2H1
383
384 To draw the board for this transcript you can use \verb=\drawtranscript{<=\emph{longstring}\verb=>}=.
385
386 \begin{center}%
387 \begin{minipage}[c]{160pt}%
388 \vspace{0pt}
389 \begin{othelloboard}{.8}
390 \othelloarrayfourthrow{0}{0}{0}{1}{2}{0}{0}{0}
391 \othelloarrayfifthrow{0}{0}{0}{2}{1}{0}{0}{0}
392 \drawtranscript{C4C3D3C5B4D2D6C6E6F4B3B5F3F5G3G4A5A6C2A4A3B6E1C1A7F2C7C8D7F6G6F7E2D1E8F8D8E7G5H3F1H6E3G1B2B1H4A1A2A8H5B7B8G2H7H8G8G7H2H1}
393 \end{othelloboard}
394 \end{minipage}
395 \hfill
396 \begin{minipage}[c]{264pt}
397 \begin{footnotesize}
398 \begin{verbatimtab}
399 \begin{othelloboard}{.8}
400 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
401 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
402 \drawtranscript{C4C3D3C5B4D2D6C6E6...B8G2H7H8G8G7H2H1}
403 \end{othelloboard}
404 \end{verbatimtab}
405 \end{footnotesize}
406 \end{minipage}
407 \end{center}
408
409 \subsection{Drawing a board diagram from a single long string}
410 Several programs use a standard long string of dashes, Xs and Os to import and export board diagrams. \textsf{othelloboard} also supports such strings. Here is a typical string taken from Cassio:
411
412 \begin{small}
413 \verb=XO---XXX-OOO-OOO-OOOOOO---OOXO---OOXOOO-OOXOOOOOXXXXX---XXXXXX--=
414 \end{small}
415
416 An `X' represents a black disc, an `O' a white disc, and a dash (`-') an empty square. The string gives the state of every square reading from the top row down, left to right.
417
418 To create a board diagram from this string, we simply feed it as an argument into the \verb=\drawboardfromstring{<=\emph{longstring}\verb=>}= command:
419 \begin{center}
420 \begin{minipage}[c]{144pt}
421 \vspace{0pt}
422 \begin{othelloboard}{.8}
423 \drawboardfromstring{XO---XXX-OOO-OOO-OOOOOO---OOXO---OOXOOO-OOXOOOOOXXXXX---XXXXXX--}
424 \end{othelloboard}
425 \end{minipage}
426 \hfill
427 \begin{minipage}[c]{272pt}
428 \begin{footnotesize}
429 \begin{verbatim}
430 \begin{othelloboard}{.8}
431 \drawboardfromstring{XO---XXX-OOO-OOO-...--XXXXXX--}
432 \end{othelloboard}
433 \end{verbatim}
434 \end{footnotesize}
435 \end{minipage}
436 \end{center}
437
438 The characters \verb=3= and \verb=4= can also be included in the string for white and black diamonds (respectively).
439
440 \section{Tweaks}
441 Feel free to tweak the code in the \verb=othelloboard.sty= file if the diagrams aren't exactly how you like them. I've commented on it quite thoroughly so that it should be easy to see which bit to tweak in order, e.g., to change the font size of the grid references, or the size of the discs relative to the grid.\\
442
443 If you know that you will want marker dots on every diagram you make, you can simply add the following to your preamble (though after you call for the package):\\
444
445 \noindent \verb=let\Oldothellogrid\othellogrid= \\
446 \verb=\renewcommand{\othellogrid}{\dotmarkings\Oldothellogrid}= \\
447
448 \noindent Now the \verb=\dotmarkings= command will be automatically executed each time you enter into an \verb=othelloboard= (or \verb=othelloboardnorefs=) environment.\\
449 \ \\
450
451 \noindent If you have any suggestions for improving or adding to this package, I'd be very keen to hear them. Or if you need some help tweaking the package for a particular application I'd be happy to hear from you about that too. Email me on \[email protected]=.
452
453
454 \clearpage
455 \appendix
456 \appendixpage
457 \section{Layout of diagrams}
458 \label{appendix:layout}
459 \noindent The board diagrams drawn with the \textsf{othelloboard} package are contained inside a \verb=picture= environment box. They behave like any diagrams drawn inside of the \verb=picture= environment and can be embedded within further boxes for accurate positioning around the page. They can also be enclosed within a \verb=figure= environment or any other float and treated like any diagram you might insert into a document, e.g.\ with labels and captions. The function of this package is just to provide diagrams neatly embedded in a box; the positioning and use of this box is up to you. However, here is some more detailed information about how the box is created and a few tips you may find useful.\\
460
461 \noindent The grid of a standard-sized diagram is contained in a 192pt$\times$192pt box that itself is positioned in the bottom right corner of a slightly larger 208pt$\times$208pt box (see dotted line), creating 16pt margins on the left and at the top to allow for alphanumeric labels with a little room spare for padding (with scaled diagrams the proportions are all kept the same, including the margins). It is the larger containing box that you control when you create a standard Othello diagram. The diagram immediately below is set with no vertical space separating it from the text above and below. \\
462 \noindent\begin{picture}(240,208)
463 \vspace{0pt}
464 \dashbox{2}(208,208)[br]{\begin{othelloboard}{1}
465 \gridrefs
466 \dotmarkings
467 \end{othelloboard}}
468 \put(24,200){\vector(-1,0){24} \scriptsize{16pt margin}}
469 \put(8,110){\vector(0,1){98}}
470 \put(4,102){\scriptsize{208pt}}
471 \put(8,98){\vector(0,-1){98}}
472 \put(28,102){\vector(0,1){90}}
473 \put(24,94){\scriptsize{192pt}}
474 \put(28,90){\vector(0,-1){90}}
475 \end{picture}
476
477 \noindent It is conceivable that you might want to create an Othello board diagram with no labels and no margins at the top and left side. In this case, you can use the \verb=othelloboardnorefs= environment (see \ref{norefs}), which works just like the \verb=othelloboard= environment except that it produces board diagrams without labels. This environment leaves out the 208pt$\times$208pt containing box that allows margins for the labels, and just draws the 192pt$\times$192pt grid inside of a 192pt$\times$192pt box. Here is an example, again with the diagram placed on the very next line of text with no vertical space, showing the absence of padding around the board.\\
478 \clearpage
479 \noindent (Paragraph of text immediately above the diagram code.)\\
480 \noindent
481 \begin{othelloboardnorefs}{1}
482 \dotmarkings
483 \end{othelloboardnorefs}
484
485 \noindent The last two diagrams are the result of putting an \verb=othelloboard= or \verb=othelloboardnorefs= environment between two paragraphs with no extra thought about spacing and layout. It may be sufficient for your needs simply to add line breaks or vertical space before and after a diagram. Alternatively, here are a couple of examples using other methods with nicer results.\\
486
487 \noindent Here's a captioned diagram enclosed and centred within a \verb=figure= environment. The code used for this and the following numbered figures is given at the end of this section.
488
489 \begin{figure}[h]
490 \begin{center}
491 \begin{othelloboard}{.8}
492 \dotmarkings
493 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
494 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
495 \end{othelloboard}
496 \caption{The opening position}
497 \end{center}
498 \end{figure}
499
500 \noindent Here's an example of a diagram set in a block of text using the \verb=wrapfig= package. \\
501
502 \noindent Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
503 \begin{wrapfigure}{r}{152pt}
504 \begin{othelloboard}{0.75}
505 \dotmarkings
506 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
507 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
508 \end{othelloboard}
509 \caption{An example using the \texttt{wrapfig} package}
510 \end{wrapfigure}
511 blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah\\
512
513 \noindent Here are a couple of diagrams side-by-side in a \verb=figure= environment.\\
514
515 \begin{figure}[ht]
516 \begin{minipage}[b]{0.5\linewidth}
517 \centering
518 \begin{othelloboard}{1}
519 \dotmarkings
520 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
521 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
522 \end{othelloboard}
523 \caption{left diagram}
524 \end{minipage}
525 \hspace{0.5cm}
526 \begin{minipage}[b]{0.5\linewidth}
527 \centering
528 \begin{othelloboard}{1}
529 \dotmarkings
530 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
531 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
532 \end{othelloboard}
533 \caption{right diagram}
534 \end{minipage}
535 \end{figure}
536
537 \noindent You might also consider using \verb=minipage=s to align diagrams, or text and diagrams, horizontally:
538
539 \begin{center}
540 \begin{minipage}[c]{192pt}
541 \textsf{
542 \begin{othelloboardnorefs}{1}
543 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
544 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
545 \annotationseighthrow{}{C}{A}{B}{B}{A}{C}{}
546 \end{othelloboardnorefs}}
547 \end{minipage}
548 \hfill
549 \begin{minipage}[c]{192pt}
550 Figure 5\\
551
552 The text over here is in the \verb=minipage= on the right. Both \verb=minipage=s are contained within a \verb=center= environment in this example.\\
553
554 The annotations are in a san-serif font this time.
555 \end{minipage}
556 \end{center}
557 \bigskip
558
559 For more examples of layouts using diagrams of different sizes, see the file: \texttt{example\--rose\--chps1\--2.pdf}.
560
561 \subsection{Code for the examples in this section}
562
563 \begin{scriptsize}
564 \begin{multicols}{2}
565 \noindent Figure 1:
566 \begin{verbatim}
567 \begin{figure}[h]
568 \begin{center}
569 \begin{othelloboard}{.8}
570 \dotmarkings
571 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
572 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
573 \end{othelloboard}
574 \caption{The opening position}
575 \end{center}
576 \end{figure}
577 \end{verbatim}
578
579 \noindent Figure 2:
580 \begin{verbatim}
581 id est laborum ...
582 \begin{wrapfigure}{r}{152pt}
583 \begin{othelloboard}{0.75}
584 \dotmarkings
585 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
586 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
587 \end{othelloboard}
588 \caption{An example using the \texttt{wrapfig}
589 package}
590 \end{wrapfigure}
591 blah blah blah blah ...
592 \end{verbatim}
593
594 \noindent Figures 3 \& 4:
595 \begin{verbatim}
596 begin{figure}[ht]
597 \begin{minipage}[b]{0.5\linewidth}
598 \centering
599 \begin{othelloboard}{1}
600 \dotmarkings
601 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
602 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
603 \end{othelloboard}
604 \caption{left diagram}
605 \end{minipage}
606 \hspace{0.5cm}
607 \begin{minipage}[b]{0.5\linewidth}
608 \centering
609 \begin{othelloboard}{1}
610 \dotmarkings
611 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
612 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
613 \end{othelloboard}
614 \caption{right diagram}
615 \end{minipage}
616 \end{figure}
617 \end{verbatim}
618
619 \noindent Figure 5:
620 \begin{verbatim}
621 \begin{center}
622 \begin{minipage}[c]{192pt}
623 \textsf{
624 \begin{othelloboardnorefs}{1}
625 \othelloarrayfourthrow {0}{0}{0}{1}{2}{0}{0}{0}
626 \othelloarrayfifthrow {0}{0}{0}{2}{1}{0}{0}{0}
627 \annotationseighthrow{}{C}{A}{B}{B}{A}{C}{}
628 \end{othelloboardnorefs}}
629 \end{minipage}
630 \hfill
631 \begin{minipage}[c]{192pt}
632 Figure 5\\
633
634 The text over here is in the \verb=minipage= on the
635 right. Both \verb=minipage=s are contained within
636 a \verb=center= environment in this example.\\
637
638 The annotations are in a san-serif font this time.
639 \end{minipage}
640 \end{center}
641 \end{verbatim}
642
643 \end{multicols}
644 \end{scriptsize}
645
646 \section{Other commands}
647
648 \noindent You may want to exploit some of the lower-level commands that were defined as part of main commands for this package. Suppose you want to draw just a couple of discs and diamonds, but without putting them in a board diagram. You might want to make sure that these are the same size and style as those used in actual board diagrams (perhaps you're writing a key like the one on page \pageref{disckey}). In that case, you can use these commands:\\
649
650 \begin{tabular}{lclc}
651 \verb=\whitedisc= \hspace{8pt}& \begin{picture}(20,20)\put(10,5){\whitedisc} \end{picture}& \verb=\whitediamond= \hspace{8pt} &\begin{picture}(20,20)\put(10,5){\whitediamond} \end{picture}\\
652 \verb=\blackdisc= \hspace{8pt}& \begin{picture}(20,20)\put(10,5){\blackdisc} \end{picture} & \verb=\blackdiamond= \hspace{8pt} &\begin{picture}(20,20)\put(10,5){\blackdiamond} \end{picture} \\
653 \end{tabular}\\
654 \ \\
655
656 They work best within a \verb=picture= environment using the \verb=\put= command for accurate placing. Note that the shapes are positioned from their centre-points. These are the same sub-commands that the \verb=\othelloarray=\ldots\verb=row= commands call upon when they execute, so using these ensures the size and style of shapes will be the same as those appearing within board diagrams within the same document.
657
658 \subsection{Counters}
659 The \textsf{othelloboard} package uses counters to store the value of discs/diamonds placed on each square (this is the same value you input in order to draw the discs/diamonds). The package currently only uses these counters to determine the text colour of annotations, but these values are available for the current board diagram until another is drawn (the counters are all reset initially as part of the code for a new diagram).
660
661 The counter names follow this format:\\
662
663 \verb=disccolourxy=\\
664
665 where \verb=xy= is the name for a square. Since \LaTeX\ doesn't allow numbers in counter names, the \verb=x= and the \verb=y= are both letters a--h. This needn't be confusing however. The convention is still standard: column name first, row name second. Thus the square g2 is called \verb=gb= for the purpose of counters.
666
667 \noindent To write the value (0--4) of the disc at g2, simply use the code: \verb=\arabic{disccolourgb}=. To use the value of the disc at g2 as part of another command, simply use \verb=\value{disccolourgb}=.
668
669 \noindent To illustrate the availability of these counters, here is a lazy way of counting discs that you might use. First, define a couple of further counters to store the number of white and black discs:\\
670
671 \verb=\newcounter{numberwdiscs}=
672
673 \verb=\newcounter{numberbdiscs}=\\
674
675 Next, define a couple of commands for counting up white (black) discs and storing the result in the counters just defined:\footnote{I've now included the full code for the example at the end of the package file in case you'd like to play with it (so you needn't define these commands yourself, they'll just work). The counting commands don't run automatically however with each diagram, to save unnecessary processing. So if you want to use the value of one of the counters, you have to run the count command first.}
676
677 \begin{verbatimtab}
678 \newcommand{\countwhitediscs}{% increments the counter for every white disc found.
679 \ifthenelse{\equal{\value{disccolouraa}}{1}}{\addtocounter{numberwdiscs}{1}}{}
680 \ifthenelse{\equal{\value{disccolourba}}{1}}{\addtocounter{numberwdiscs}{1}}{}
681 ... }
682 \end{verbatimtab}
683
684 \noindent Now you can just run the count commands and write \verb=\arabic{numberwdiscs}= or \\
685 \verb=\arabic{numberbdiscs}= to print the number of white (black) discs.
686 \begin{center}
687 \begin{minipage}[c]{192pt}
688 \textsf{
689 \begin{othelloboard}{.6}
690 \dotmarkings
691 \othelloarrayfirstrow{2}{2}{2}{2}{2}{2}{2}{2}
692 \othelloarraysecondrow{2}{2}{2}{2}{2}{1}{1}{2}
693 \othelloarraythirdrow{2}{1}{1}{2}{1}{1}{1}{2}
694 \othelloarrayfourthrow {2}{1}{2}{1}{1}{1}{1}{2}
695 \othelloarrayfifthrow {2}{2}{2}{1}{1}{1}{1}{2}
696 \othelloarraysixthrow {2}{2}{1}{1}{1}{1}{1}{2}
697 \othelloarrayseventhrow {0}{1}{2}{1}{2}{2}{2}{2}
698 \othelloarrayeighthrow {1}{0}{2}{1}{1}{1}{1}{1}
699 \end{othelloboard}}
700 \end{minipage}
701 %\hfill
702 \begin{minipage}[c]{192pt}
703 \countwhitediscs
704 \countblackdiscs
705 Number of white discs: \arabic{numberwdiscs} \\
706 Number of black discs: \arabic{numberbdiscs} \\
707 \end{minipage}
708 \end{center}
709 \ \\
710
711 Admittedly this doesn't seem like a very useful feature, but if you like playing with this sort of thing you might find it useful to know that the \verb=disccolourxy= counters are available for use after each diagram is drawn.
712
713 \section{Most likely errors}
714
715 \begin{itemize}
716 \item Forgetting to specify a size argument along with the \verb=\begin{othelloboard}= declaration.
717 \item Putting spaces between the `\verb=w=' in a command name and the `\verb={=' of the first argument. Use tabs if you want to align the arguments for an array (see section \ref{tabtips} above). Also make sure there are no spaces between arguments.
718 \item Forgetting to include an \verb=\end{othelloboard}= declaration at the end of each diagram.
719 \end{itemize}
720
721 \section{Changes}
722 \subsubsection*{18 August 2011}
723 \begin{itemize}
724 \item Extended the \verb=\drawboardfromstring= command to recognize the characters \verb=3= and \verb=4= (for diamonds) in a string.
725 \item Included example material typeset using this package -- two chapters from Brian Rose's book.
726 \end{itemize}
727
728 \bibliographystyle{phil_review}
729 \begin{thebibliography}{1}
730 \bibitem{Rose2005} Brian Rose (2005). \emph{Othello: A Minute to Learn \ldots\ A Lifetime to Master}.\\[6pt]
731 The official version can be downloaded from http://othellogateway.com/rose/book.pdf.
732 \end{thebibliography}
733
734 \clearpage
735
736 \makebox[0pt][l]{\hspace{-64pt}
737 \begin{othelloboard}{2.6}
738 \dotmarkings
739 \othelloarrayfirstrow {1}{2}{1}{1}{2}{1}{2}{1}
740 \othelloarraysecondrow {2}{1}{2}{2}{2}{1}{2}{2}
741 \othelloarraythirdrow {2}{2}{2}{1}{2}{1}{1}{1}
742 \othelloarrayfourthrow {1}{1}{2}{1}{2}{1}{2}{2}
743 \othelloarrayfifthrow {2}{1}{1}{2}{1}{2}{2}{1}
744 \othelloarraysixthrow {1}{2}{2}{1}{2}{2}{1}{1}
745 \othelloarrayseventhrow {2}{1}{1}{2}{1}{1}{2}{2}
746 \othelloarrayeighthrow {2}{1}{2}{2}{1}{1}{2}{1}
747 \annotationsfirstrow {54} {51} {34} {30} {31} {32} {41} {42}
748 \annotationssecondrow {55} {50} {43} {33} {29} {28} {39} {58}
749 \annotationsthirdrow {23} {27} {3} {4} {25} {8} {40} {59}
750 \annotationsfourthrow {24} {22} {5} {} {} {6} {37} {60}
751 \annotationsfifthrow {47} {20} {14} {} {} {1} {35} {38}
752 \annotationssixthrow {26} {21} {15} {2} {9} {7} {12} {36}
753 \annotationsseventhrow {49} {56} {16} {11} {10} {18} {45} {53}
754 \annotationseighthrow {57} {46} {17} {13} {44} {52} {19} {48}
755 \end{othelloboard}
756 }
757
758
759 %------
760 \end{document}