diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-13 00:01:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-13 00:01:21 +0000 |
commit | ee965e2b81f8159563e429832406e0b7344682db (patch) | |
tree | 9e420985e6702a029e9ae314c1a01033cc3db22d /Master/texmf-dist/tex/latex/othello | |
parent | 87d234d7c1ab6698765aedc15231af1fd0103a0b (diff) |
othello
git-svn-id: svn://tug.org/texlive/trunk@1158 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/othello')
-rw-r--r-- | Master/texmf-dist/tex/latex/othello/othello.sty | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/othello/othello.sty b/Master/texmf-dist/tex/latex/othello/othello.sty new file mode 100644 index 00000000000..296b3afcc39 --- /dev/null +++ b/Master/texmf-dist/tex/latex/othello/othello.sty @@ -0,0 +1,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 + |