diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/psbao/README | 28 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/psbao/psbaomanual.pdf | bin | 0 -> 95794 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/psbao/psbaomanual.tex | 350 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/psbao/psbao.sty | 730 |
4 files changed, 1108 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/psbao/README b/Master/texmf-dist/doc/latex/psbao/README new file mode 100644 index 00000000000..1038da6aee5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/psbao/README @@ -0,0 +1,28 @@ +PSBAO is a LaTeX2e package to draw Bao diagrams in LaTeX. It has been created using the Go package written by Victor Bos (September 4, 2008) as basis and it is built on top of the PSTricks package. + +To all the people who have never played bao I suggest to visit: http://www.swahili.it/bao. + +To install the package, place the file psbao.sty in a directory where +LaTeX can find it. That is, it should be somewhere on TEXINPUTS. + +For more information, see the manual (psbaomanual.{pdf,tex}). + +---------------------------------------------------------------------- +COPYRIGHT + +psbao +Copyright 2008 N. Vessella + +This program may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.2 +of this license or (at your option) any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.2 or later is part of all distributions of LaTeX +version 1999/12/01 or later. + +This program consists of the files: + + psbao.sty + psbaomanual.tex +---------------------------------------------------------------------- diff --git a/Master/texmf-dist/doc/latex/psbao/psbaomanual.pdf b/Master/texmf-dist/doc/latex/psbao/psbaomanual.pdf Binary files differnew file mode 100644 index 00000000000..dc2ccf7c2df --- /dev/null +++ b/Master/texmf-dist/doc/latex/psbao/psbaomanual.pdf diff --git a/Master/texmf-dist/doc/latex/psbao/psbaomanual.tex b/Master/texmf-dist/doc/latex/psbao/psbaomanual.tex new file mode 100644 index 00000000000..adc637dd699 --- /dev/null +++ b/Master/texmf-dist/doc/latex/psbao/psbaomanual.tex @@ -0,0 +1,350 @@ +%% psbaomanual.tex +% This program consists of the files: +% +% psbao.sty +% psbaomanual.tex +% +% +\documentclass[a4paper]{book} +\usepackage{psbao,array,url,lettrine,float,multicol} +\newcommand{\pstricks}{\textsf{PSTricks}} +\newcommand{\commandname}[1]{{\ttfamily\symbol{'134}#1}} +% The following code is taken from the doc package. It defines a global +% macro \bslash that produces a bslash (if present in the current font). +\makeatletter +{\catcode`\|=\z@ \catcode`\\=12 |gdef|bslash{\}} +\makeatother +\newcommand{\cmd}[1]{\texttt{\bslash #1}} + +\title{\psbao\\{\normalfont\normalsize Typesetting Bao Diagrams with \pstricks}} +\author{Nino Vessella\\web site: www.vessella.it} +\date{October, 2008} + +\setbaounit{0.5cm} + +\begin{document} +\maketitle + +\section*{Introduction} + +\lettrine[lines=2]{\textbf{T}}{his package} provides functionality to typeset Bao diagrams in \LaTeXe. It has been created using the Go package written by Victor Bos (September 4, 2008) as basis and it is built on top of the \pstricks{} package. + +To all the people who have never played bao I suggest to visit \textit{\url{http://www.swahili.it/bao}}. + +\section*{Download and installation} + +\lettrine[lines=2]{\textbf{T}}{he} \psbao{} package can be found at CTAN (mirrors) in the directory\linebreak +\url{graphics/pstricks/contrib/psbao/}. + +\noindent It is also available from +\url{http://www.vessella.it/ghala/}. +\medskip + +To install the package, download the files +\texttt{psbao.sty} and \texttt{psbaomanual.tex} and put them in a +directory where \LaTeX{} can find them. After that, test the +installation by running \LaTeX{} on \texttt{psbaomanual.tex}. + +Note that \textsf{psbao} uses \textsf{pstricks} to draw +graphics. Therefore, the same things that apply to viewing and +printing documents with \textsf{pstricks} graphics also apply to +documents with \textsf{psbao} graphics. In particular, it is usually +better to use a PostScript viewer (e.g., \texttt{gv} or +\texttt{gsview}) instead of a DVI viewer (like \texttt{xdvi} or +\texttt{yap}). + +\section*{Bao boards} + +\lettrine[lines=2]{\textbf{T}}{he} interface of \psbao{} is based on the notation used in\linebreak\url{http://www.swahili.it/bao/}. That is, the rows of the $4\times8$ board are indexed by $1,2,\ldots,8$ and the columns are indexed by $b, a, A, B$. + +First of all it must be set the initial position of a Bao game. For the standard initial setting is used the command \verb|\initbao|, but the board is showed by the environmnet \verb|\begin{showbaoboard}| $\dots$ \verb|\end{showbaoboard}| (Figure~\ref{fig:ko:standard}): + +\begin{figure}[!ht] +\setlength{\columnsep}{20pt}\small +\begin{multicols}{2} +\noindent Code:\\ +\mbox{}\\ +\begin{verbatim} +\initbao +\begin{figure} + \begin{center} + \begin{showbaoboard} + \end{showbaoboard} + \caption{...} + \label{fig:...} + \end{center} +\end{figure} +\end{verbatim} +\mbox{}\\ +Prints:\\ +\mbox{}\\ + \begin{showbaoboard} + \end{showbaoboard} +\mbox{}\\ +\caption{Setting up the standard initial situation: default size 0.6cm} +\label{fig:ko:standard} +\end{multicols} +\end{figure} + + +For the initial setting of the beginner's variant \textit{Bao la kujifunza} is used the command \verb|\initjbao| (Figure~\ref{fig:empty:jifunza}): + +\begin{figure}[!ht] +\setlength{\columnsep}{20pt}\small +\begin{multicols}{2} +\noindent Code:\\ +\mbox{}\\ +\begin{verbatim} +\initjbao +\begin{figure} + \begin{center} + \begin{showbaoboard} + \end{showbaoboard} + \caption{...} + \label{fig:...} + \end{center} +\end{figure} +\end{verbatim} +\mbox{}\\ +Prints:\\ +\mbox{}\\ +\initjbao + \begin{showbaoboard} + \end{showbaoboard} +\mbox{}\\ + \caption{Bao la kujifunza} + \label{fig:empty:jifunza} +\end{multicols} +\end{figure} + +The default horizontal unit distance is~$0.6$cm. The vertical unit distance is computed by the \psbao{} package. +To re-size a Bao board, the command +\verb|\setbaounit| can be used. This command takes the desired +horizontal unit distance as an argument. It is not advisable, though possible, to set the unit distance to a value less than 0.3cm, see Figure~\ref{fig:empty:resize}(b). + +\initbao +\weka{0}{n}{0} +\weka{0}{a}{5} % 3,0 +\weka{0}{a}{6} % 2,1 +\weka{0}{a}{7} % 1,2 +\weka{0}{A}{5} % 0,3 +\weka{0}{A}{6} +\weka{0}{A}{7} +\weka{0}{s}{0} +\weka{10}{b}{2} % 3,0 +\weka{27}{a}{2} % 2,1 +\weka{33}{A}{2} % 1,2 +\weka{4}{B}{2} % 0,3 +\weka{10}{A}{1} +\begin{figure}[H] + \begin{center} + \begin{tabular}{cc} + \setbaounit{.5cm} + \begin{showbaoboard} + \end{showbaoboard} +& + \setbaounit{0.3cm} + \weka{10}{b}{2} % 3,0 + \weka{27}{a}{2} % 2,1 + \weka{33}{A}{2} % 1,2 + \weka{4}{B}{2} % 0,3 + \weka{10}{A}{1} + \begin{showbaoboard} + \end{showbaoboard} +\\ +\\ +(a) Horizontal step 0.5cm. +& +(b) Horizontal step 0.3cm. +\end{tabular} + \caption{Resized Bao boards} + \label{fig:empty:resize} + \end{center} +\end{figure} + +For the diagrams in this document we have set the horizontal +unit distance to~$0.5$cm (\verb|\setbaounit{0.5cm}|). + +\section*{Seeds and situations} + +\lettrine[lines=2]{\textbf{T}}{he command} to put seeds into the holes is \verb|\weka| which takes three parameters: the number of seeds, the row and the column of the hole. For example, \verb|\weka{2}{a}{4}| puts two seeds into the hole at position~$(a,4)$. The \verb|\weka| command can be used to modify a previous situation. For instance, the situation of Figure~\ref{fig:ko:situation} is defined as follows. + +\begin{figure}[!ht] +\setlength{\columnsep}{20pt}\small +\begin{multicols}{2} +\noindent Code:\\ +\mbox{}\\ +\begin{verbatim} +\weka{1}{b}{2} % 3,0 +\weka{2}{a}{2} % 2,1 +\weka{3}{A}{2} % 1,2 +\weka{4}{B}{2} % 0,3 +\weka{5}{A}{1} +\weka{9}{A}{3} +\begin{showbaoboard} +\end{showbaoboard} +\end{verbatim} +Prints:\\ +\mbox{}\\ +\weka{1}{b}{2} % 3,0 +\weka{2}{a}{2} % 2,1 +\weka{3}{A}{2} % 1,2 +\weka{4}{B}{2} % 0,3 +\weka{5}{A}{1} +\weka{9}{A}{3} +\begin{showbaoboard} +\end{showbaoboard} +\mbox{}\\ + \caption{Example of weka} + \label{fig:ko:situation} +\end{multicols} +\end{figure} + +The same situation can be set by \verb|\initbao| which takes one optional parameter to indicate the number of seeds contained in all holes (Figure~\ref{fig:ko:sit}). + +\begin{figure}[!ht] +\setlength{\columnsep}{20pt}\small +\begin{multicols}{2} +\noindent Code:\\ +\mbox{}\\ +\begin{verbatim} +\initbao[0,% + 0,0,0,0,0,0,1,0,% + 0,0,0,0,0,0,1,0,% + 5,3,0,0,0,0,0,0,% + 0,3,9,0,0,0,0,0,% + 0] +\begin{figure} +\begin{center} + \begin{showbaoboard} + \end{showbaoboard} +\end{center} +\end{figure} +\end{verbatim} +Prints:\\ +\mbox{}\\ +\initbao[0,% + 0,0,0,0,0,0,1,0,% + 0,0,0,0,0,0,1,0,% + 5,3,0,0,0,0,0,0,% + 0,3,9,0,0,0,0,0,% + 0] + \begin{showbaoboard} + \end{showbaoboard} +\mbox{}\\ + \caption{Writing the number of seeds of all holes} + \label{fig:ko:sit} +\end{multicols} +\end{figure} + +To put seeds into the stores is used the same command: \verb|\weka|. In this case instead of index of the row can be used the letters $s$ or $S$ for the south store, and the letters $n$ or $N$. For example, \verb|\weka{2}{s}{4}| puts two seeds into the store of South. The third parameter must be any number. +\begin{figure}[!ht] +\setlength{\columnsep}{20pt}\small +\begin{multicols}{2} +\noindent Code:\\ +\begin{verbatim} +\begin{showbaoboard} +\weka{10}{n}{2} +\weka{1}{b}{2} +\weka{2}{a}{2} +\weka{3}{A}{2} +\weka{4}{B}{2} +\weka{5}{A}{1} +\weka{9}{A}{3} +\weka{9}{s}{3} +\end{showbaoboard} +\end{verbatim} +\mbox{}\\ +\mbox{}\\ +Prints:\\ +\mbox{}\\ +\weka{10}{n}{2} +\weka{1}{b}{2} % 3,0 +\weka{2}{a}{2} % 2,1 +\weka{3}{A}{2} % 1,2 +\weka{4}{B}{2} % 0,3 +\weka{5}{A}{1} +\weka{9}{A}{3} +\weka{9}{s}{3} +\begin{showbaoboard} +\end{showbaoboard} +\mbox{}\\ +\caption{Setting up a situation with stores} +\label{fig:ko:ghala} +\end{multicols} +\end{figure} + +The command: \verb|\weka| keeps the previous situation, so if it is necessary to set a completely new situation it must be used the command \verb|\initbao|. + +\section*{Markers} + +\lettrine[lines=2]{\textbf{A}}{ hole} on the board can be marked with the command \verb|\markpos|. This command takes three parameters: the +marker, the column, and the row. Available markers and the commands to +generate them are listed in Table~\ref{tbl:markers}. + +Note that to mark a non-empty hole the command \verb|\weka| have to be used together with marker command, \verb|\markpos|. + +Note, also, that the special holes (as \textit{kichwa} or \textit{kimbi}) can be used the marks \verb|\markdd| or \verb|\markss|, indifferently (but consistently!). Those commands must be inside the environment \verb|\begin{showboard}| $dots$ \verb|\end{showboard}|. + +\setbaounit{0.4cm} +\weka{1}{b}{2} +\weka{2}{a}{2} +\weka{3}{A}{2} +\weka{4}{B}{2} +\weka{5}{A}{1} +\weka{9}{A}{3} +\begin{table} +\begin{center} +\begin{tabular}{|c|l|l|l|} +\hline +Diagram & Mark & Description & Command\\ +\hline\hline +\raisebox{0.2\height} +{% +\begin{showbaoboard} +\markpos{\marksx}{a}{2} +\end{showbaoboard}% +} & +\commandname{marksx} & a2\textless & +{\commandname{markpos}\{\commandname{marksx}\}\{a\}\{2\}}\\\hline +% +\raisebox{0.2\height} +{ +\begin{showbaoboard} +\markpos{\markdx}{A}{3} +\end{showbaoboard} +} & +\commandname{markdx}& A3\textgreater & +{\commandname{markpos}\{\commandname{markdx}\}\{A\}\{3\}}\\\hline +% +\raisebox{0.2\height} +{ +\begin{showbaoboard} +\markpos{\markss}{a}{2} +\end{showbaoboard}} & +\commandname{markss}& Special hole & +{\commandname{markpos}\{\commandname{markss}\}\{a\}\{2\}}\\\hline +% +\raisebox{0.2\height} +{ +\begin{showbaoboard} +\markpos{\markdd}{A}{1} +\end{showbaoboard}} & +\commandname{markdd}& Special hole & +{\commandname{markpos}\{\commandname{markdd}\}\{A\}\{1\}}\\\hline +% +\raisebox{0.2\height} +{ +\begin{showbaoboard} +\markpos{\markma}{A}{5} +\end{showbaoboard}} & +\commandname{markma}& Any nr of seeds & +{\commandname{markpos}\{\commandname{markma}\}\{A\}\{5\}}\\\hline +\end{tabular} +\caption{Markers on holes} +\label{tbl:markers} +\end{center} +\end{table} + + +\end{document} diff --git a/Master/texmf-dist/tex/latex/psbao/psbao.sty b/Master/texmf-dist/tex/latex/psbao/psbao.sty new file mode 100644 index 00000000000..3f369b5854a --- /dev/null +++ b/Master/texmf-dist/tex/latex/psbao/psbao.sty @@ -0,0 +1,730 @@ +%% psbao.sty +%% Copyright 2004, 2003,2001 V. Bos +% +% This program may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.2 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.2 or later is part of all distributions of LaTeX +% version 1999/12/01 or later. +% +% This program consists of the files: +% +% psbao.sty +% psbaomanual.tex +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% MOST OF THE FOLLOWING CODE IS COPIED FROM psgo.sty % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\NeedsTeXFormat{LaTeX2e}% +\ProvidesPackage{psbao}[2008/09/04, v0.17] +\message{`PSBAO', <2008/09/04>, v0.17} +\RequirePackage{pstricks,pst-node,calc,ifthen,cool,etex} + +\newcommand{\psbao}{\textsf{psbao}} +\newsavebox{\stmarkbox} +\newcounter{boardrow} +\newcounter{boardcol} +\newcounter{ghalaku} % granaio sud +\newcounter{ghalaka} % granaio nord +\newcounter{tmpglob} +\newlength{\baoxunit} +\newlength{\baoyunit} +\newcounter{nvi} +\newcounter{nvii} +\newcounter{nviii} +\newcounter{nviv} +\newcounter{nvv} +\newcounter{nvvi} +\newcounter{nvvii} +\newcounter{nvviii} +\newcounter{nvix} +\newcounter{nvx} +\newcounter{nvxi} +\newcounter{nvxii} +\newcounter{nvxiii} +\newcounter{nvxiv} +\newcounter{nvxv} +\newcounter{nvxvi} +\newcounter{nvxvii} +\newcounter{nvxviii} +\newcounter{nvxix} +\newcounter{nvxx} +\newcounter{nvxxi} +\newcounter{nvxxii} +\newcounter{nvxxiii} +\newcounter{nvxxiv} +\newcounter{nvxxv} +\newcounter{nvxxvi} +\newcounter{nvxxvii} +\newcounter{nvxxviii} +\newcounter{nvxxix} +\newcounter{nvxxx} +\newcounter{nvxxxi} +\newcounter{nvxxxii} +\newcounter{nvxxxiii} +\newcounter{nvxxxiv} + +\newcommand{\setbaounit}[1]{ + \setlength{\baoxunit}{#1} + \setlength{\baoyunit}{1.115\baoxunit} +} + +\newcommand{\initbao}[1][22,% + 0,0,0,0,0,0,0,0,% + 0,2,2,6,0,0,0,0,% + 0,0,0,0,6,2,2,0,% + 0,0,0,0,0,0,0,0,% + 22]{% + \liststore{#1}{bc} + % There should be a better way to write the following lines! + \setcounter{nvi}{\bci} + \setcounter{nvii}{\bcii} + \setcounter{nviii}{\bciii} + \setcounter{nviv}{\bciv} + \setcounter{nvv}{\bcv} + \setcounter{nvvi}{\bcvi} + \setcounter{nvvii}{\bcvii} + \setcounter{nvviii}{\bcviii} + \setcounter{nvix}{\bcix} + \setcounter{nvx}{\bcx} + \setcounter{nvxi}{\bcxi} + \setcounter{nvxii}{\bcxii} + \setcounter{nvxiii}{\bcxiii} + \setcounter{nvxiv}{\bcxiv} + \setcounter{nvxv}{\bcxv} + \setcounter{nvxvi}{\bcxvi} + \setcounter{nvxvii}{\bcxvii} + \setcounter{nvxviii}{\bcxviii} + \setcounter{nvxix}{\bcxix} + \setcounter{nvxx}{\bcxx} + \setcounter{nvxxi}{\bcxxi} + \setcounter{nvxxii}{\bcxxii} + \setcounter{nvxxiii}{\bcxxiii} + \setcounter{nvxxiv}{\bcxxiv} + \setcounter{nvxxv}{\bcxxv} + \setcounter{nvxxvi}{\bcxxvi} + \setcounter{nvxxvii}{\bcxxvii} + \setcounter{nvxxviii}{\bcxxviii} + \setcounter{nvxxix}{\bcxxix} + \setcounter{nvxxx}{\bcxxx} + \setcounter{nvxxxi}{\bcxxxi} + \setcounter{nvxxxii}{\bcxxxii} + \setcounter{nvxxxiii}{\bcxxxiii} + \setcounter{nvxxxiv}{\bcxxxiv} +} + +\newcommand{\initjbao}{ + \setcounter{nvi}{0} + \setcounter{tmpglob}{2} + \whiledo{\value{tmpglob} < 34} + {% + \setcounter{nv\roman{tmpglob}}{2} + \stepcounter{tmpglob}% + }% + \setcounter{nvxxxiv}{0} +} + +\initbao +\setbaounit{0.6cm} +\newcommand{\hatchangle}{-42.5} % non usato +\newlength{\tmplx} +\newlength{\tmply} +\newlength{\tmpxa}% non usato +\newlength{\tmpxb}% non usato +\newlength{\tmpya}% non usato +\newlength{\tmpyb}% non usato +\newcounter{tmpc} + +\newcommand{\pointbox}[1]{% +\raisebox{-0.5\height+0.5\depth}[0pt][0pt]{\makebox[0pt]{#1}}% +} + +%\newcommand{\baolabelformat}[1]{{\sffamily #1}} +\newcommand{\baolabelformat}[1]{% +{\sffamily {\footnotesize{#1}}}% +} + +\newcommand{\baoxposition}[1]{% + \ifx#1B 0\else% + \ifx#1A 1\else% + \ifx#1a 2\else% + \ifx#1b 3\else% + \ifx#1c 2\else% + \ifx#1d 3\else% + \ifx#1e 4\else% + \ifx#1f 5\else% + \ifx#1g 6\else% + \ifx#1h 7\else% + \ifx#1j 8\else% + \ifx#1k 9\else% + \ifx#1l 10\else% + \ifx#1m 11\else% + \ifx#1n 12\else% + \ifx#1o 13\else% + \ifx#1p 14\else% + \ifx#1q 15\else% + \ifx#1r 16\else% + \ifx#1s 17\else% + \ifx#1t 18\else% + \relax% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% +}% + +\newcommand{\baoyposition}[1]{% + \ifnum#1=1 0\else% + \ifnum#1=2 1\else% + \ifnum#1=3 2\else% + \ifnum#1=4 3\else% + \ifnum#1=5 4\else% + \ifnum#1=6 5\else% + \ifnum#1=7 6\else% + \ifnum#1=8 7\else% + \ifnum#1=9 8\else% + \ifnum#1=10 9\else% + \ifnum#1=11 10\else% + \ifnum#1=12 11\else% + \ifnum#1=13 12\else% + \ifnum#1=14 13\else% + \ifnum#1=15 14\else% + \ifnum#1=16 15\else% + \ifnum#1=17 16\else% + \ifnum#1=18 17\else% + \ifnum#1=19 18\else% + \relax% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% +}% + +\newcommand{\redim}[1]{% +% \the\baoxunit + \ifdim \baoxunit > 24pt +% {\huge{##1}} + {\LARGE{#1}} + \else% + \ifdim \baoxunit > 20pt + {\Large{#1}} + \else% + \ifdim \baoxunit > 17pt + {\large{#1}} + \else% + \ifdim \baoxunit > 14pt + {\normalsize{#1}} + \else% + \ifdim \baoxunit > 12pt + {\small{#1}} + \else% + \ifdim \baoxunit > 10pt + {\footnotesize{#1}} + \else% + \ifdim \baoxunit > 9pt + {\scriptsize{#1}} + \else% + {\tiny{#1}}% + \fi + \fi + \fi + \fi + \fi% + \fi + \fi% + }% + +\newenvironment{baomoves}{% + \newcommand{\placesymbol}[3]{% + \ifthenelse{4 > \baoxposition{##2}% + \and % + 8 > \baoyposition{##3}}% + {\rput[l](\baoyposition{##3},\baoxposition{##2}){\redim{##1}}% + }% + {}% + }% + \newcommand{\markpos}[3] + {% + % Here should be used the macro \conx + \newcount\sud + \newcount\nord + \newcount\b + \nord=9 + \sud=##3 + \b=##3 + \advance \nord by -\b + \if ##2b + \b = \nord% + \else + \if ##2a + \b = \nord% + \else + \if ##2A + \b = \sud% + \else + \if ##2B + \b = \sud% + \fi + \fi + \fi + \fi + \placesymbol{\psframebox[dimen=inner,% + linestyle=none,% + boxsep=false,% + framesep=0.3\baoxunit]{##1}}{##2}{\b} + }% + \newcommand{\kete}[3] + {% + \placesymbol{% + {\psset{linecolor=black,% + fillcolor=black,% + hatchcolor=gray,% + unit=0.5\baoxunit}\color{black}##1}}{##2}{##3}% + }% + \newcommand{\ghala}[3] + {% + \ifx ##2S + \setcounter{ghalaku}{##1} % 20 + \setcounter{ghalaka}{0} + \else + \ifx ##2s + \setcounter{ghalaku}{##1} % 20 + \setcounter{ghalaka}{0} + \else + \setcounter{ghalaku}{0} + \setcounter{ghalaka}{##1} % 19 + \fi + \fi + \ifnum \value{ghalaka}>0% + \rput(-1\baoxunit,2.5\baoyunit){\redim{\arabic{ghalaka}}}% % 19 + \fi% + \ifnum \value{ghalaku}>0% + \rput(8.3\baoxunit,0.5\baoyunit){\redim{\arabic{ghalaku}}}% % 19 + \fi% + \setcounter{ghalaku}{0} + \setcounter{ghalaka}{0} + }% + +\newcommand{\conx}[2]{% + \newcount\sud + \newcount\nord + \newcount\b + \nord=9 + \sud=##2 + \b=##2 + \advance \nord by -\b + \if ##1b \nord% + \else + \if ##1a \nord + \else + \if ##1A \sud + \else + \if ##1B \sud + \fi + \fi + \fi + \fi +}% +\renewcommand{\seeds}[3]{% +% \kete[\stmark]{##2}{\conx{##2}{##3}}% + % Here should be used the macro \conx + \newcount\sud + \newcount\nord + \newcount\b + \nord=9 + \sud=##3 + \b=##3 + \advance \nord by -\b + \def\stmark{\pointbox{##1}}% + \if ##2b + \kete{\stmark}{##2}{\nord}% + \else + \if ##2a + \kete{\stmark}{##2}{\nord}% + \else + \if ##2A + \kete{\stmark}{##2}{\sud}% + \else + \if ##2B + \kete{\stmark}{##2}{\sud}% + \else + \ghala{##1}{##2}{##3}% + \fi + \fi + \fi + \fi +}% +% +\newcommand{\baoarrow}[2] +{ + % Here should be used the macro \conx + \newcount\sud + \newcount\nord + \newcount\b + \nord=9 + \sud=##2 + \b=##2 + \advance \nord by -\b + \if ##1b + \b = \nord% + \else + \if ##1a + \b = \nord% + \else + \if ##1A + \b = \sud% + \else + \if ##1B + \b = \sud% + \fi + \fi + \fi + \fi +\pstriangle[gangle=90](\baoyposition{\b},\baoxposition{##1})(1,.5) +%\psline[linewidth=1.4pt, +% linecolor=black, +% linestyle=solid, +% arrowscale=1.5]% +% {>-}% +% (\baoyposition{\b},\baoxposition{##1}) +% (\baoyposition{\b},\baoxposition{##1}) +% (0.1\baoyposition{##2},\baoxposition{\b})% +%} +}% +}{}% + +\newcommand{\xpositionmarks}[2]{% + \setcounter{tmpglob}{9}% + \whiledo{\value{#1} < #2}{% + \rput[B](\value{#1},-1.1\baoyunit){% + \addtocounter{#1}{1}% + \ifthenelse{\value{#1} > 8}% + {\addtocounter{#1}{1}\baolabelformat{\arabic{#1}}\addtocounter{#1}{-1}}% + {\baolabelformat{\arabic{#1}}}% + \addtocounter{#1}{-1}}% + \setlength{\tmply}{4\baoyunit}% + \rput[t](\value{#1},\tmply){% + \addtocounter{#1}{1}% + \ifthenelse{\value{#1} > 4}% + {\addtocounter{#1}{1} + \addtocounter{tmpglob}{-1}% + \baolabelformat{\arabic{tmpglob}} + \addtocounter{#1}{-1} + }% + { + \addtocounter{tmpglob}{-1}% + \baolabelformat{\arabic{tmpglob}} + }% + \addtocounter{#1}{-1}}% + \stepcounter{#1}% + }% +}% +\newcommand{\ypositionmarks}[2]{% + \whiledo{\value{#1} < 4}{% + \ifthenelse{\value{#1} > 1}% + {% + \addtocounter{#1}{-1} + \edef\etnord{\alph{#1}}% + \addtocounter{#1}{1}% + \setlength{\tmplx}{#2\baoxunit}% + \rput[l](\tmplx,\value{#1}){\baolabelformat{\etnord}}% + }% + {% + \ifthenelse{\value{#1} = 0} + { + \addtocounter{#1}{2} + \edef\etsud{\Alph{#1}} + \addtocounter{#1}{-2} + } + { + \edef\etsud{\Alph{#1}} + } + \rput[r](-\baoxunit,\value{#1}){\baolabelformat{\etsud}}% + }% + \stepcounter{#1}% + }% +}% + +\def\psbaosetboardsizes(#1,#2)(#3,#4){% + \def\psbaollx{#1}% + \def\psbaolly{#2}% +% \ifthenelse{#3 > \value{boardcol}} +% {\def\psbaourx{\value{boardcol}}} +% {\def\psbaourx{#3}}% + \def\psbaourx{#3}% +% \ifthenelse{#4 > \value{boardrow}} +% {\def\psbaoury{\value{boardrow}}} +% {\def\psbaoury{#4}}% + \def\psbaoury{#4}% +} + +\newboolean{withindices}% +\setboolean{withindices}{true}% + +% psbaopartialboard[8](0,0)(8,4) +\newenvironment{psbaopartialboard}[2][8] +{% + \setcounter{boardcol}{8}% + \setcounter{boardrow}{4}% + \psbaosetboardsizes#2% + \psset{xunit=\baoxunit,yunit=\baoyunit}% + \ifthenelse{\boolean{withindices}}% + {\def\xoffset{2\baoxunit}\def\yoffset{2\baoyunit}}% + {\def\xoffset{.5\baoxunit}\def\yoffset{.5\baoyunit}}% + % psbaollx=0 + \ifthenelse{\psbaollx = 1 \or \psbaollx < 1}% + {\def\psbaollxval{-\xoffset}}% + {\setlength% + {\tmplx}% + {\psbaollx\baoxunit - 1\baoxunit}% + \edef\psbaollxval{\the\tmplx}% + }% + % psbaoly=0 + \ifthenelse{\psbaolly = 1 \or \psbaolly < 1}% + {\def\psbaollyval{-.5\yoffset}}% + {\setlength{\tmply}{\psbaolly\baoyunit - 1\baoyunit}\edef\psbaollyval{\the\tmply}}% + % psbaorx=8 + \ifthenelse{\psbaourx = \value{boardcol} \or \psbaourx > \value{boardcol}}% + {\setlength{\tmplx}{\value{boardcol}\baoxunit - \baoxunit + \xoffset}% + \edef\psbaourxval{\the\tmplx}}% + {\def\psbaourxval{\psbaourx\baoxunit}}% + % psbaory=4 + \ifthenelse{\psbaoury = \value{boardrow} \or \psbaoury > \value{boardrow}}% + {\setlength{\tmply}{\value{boardrow}\baoyunit - \baoyunit + \yoffset}% + \edef\psbaouryval{\the\tmply}}% + {\def\psbaouryval{\psbaoury\baoyunit}}% + % 0, 0 8, 4 + \begin{pspicture}(\psbaollxval,\psbaollyval)(\psbaourxval,\psbaouryval)% + \ifthenelse{\psbaollx = 1 \or \psbaollx < 1}% + {\def\psbaollxval{-\xoffset}}% + {\setlength{\tmplx}{\psbaollx\baoxunit - 1.5\baoxunit}\edef\psbaollxval{\the\tmplx}}% + \ifthenelse{\psbaolly = 1 \or \psbaolly < 1}% + {\def\psbaollyval{-\yoffset}}% + {\setlength{\tmply}{\psbaolly\baoyunit - 1.5\baoyunit}\edef\psbaollyval{\the\tmply}}% + \ifthenelse{\psbaourx = \value{boardcol} \or \psbaourx > \value{boardcol}}% + {\setlength{\tmplx}{\value{boardcol}\baoxunit - \baoxunit + \xoffset}% + \edef\psbaourxval{\the\tmplx}}% + {\setlength{\tmplx}{\psbaourx\baoxunit - .5\baoxunit}% + \edef\psbaourxval{\the\tmplx}}% + \ifthenelse{\psbaoury = \value{boardrow} \or \psbaoury > \value{boardrow}}% + {\setlength{\tmply}{\value{boardrow}\baoyunit - \baoyunit + \yoffset}% + \edef\psbaouryval{\the\tmply}}% + {\setlength{\tmply}{\psbaoury\baoyunit - .5\baoyunit}% + \edef\psbaouryval{\the\tmply}}% +\psclip{\psframe[linecolor=white,linewidth=0](\psbaollxval,\psbaollyval)(\psbaourxval,\psbaouryval)}% + \setlength{\tmply}{\value{boardrow}\baoyunit + 0.5\baoyunit}% + \setlength{\tmplx}{\value{boardcol}\baoxunit + 0.5\baoxunit}% + \addtolength{\tmply}{-1.5\baoyunit}% + \addtolength{\tmplx}{-1.5\baoxunit}% + +\multips(0,0)(1,0){\value{boardcol}} +{\pscircle[fillstyle=solid,linewidth=0.5pt](0,0){0.4\baoxunit} +\multips(0,0)(0,1){\value{boardrow}}{\pscircle[fillstyle=solid,linewidth=0.5pt](0,0){0.4\baoyunit}} +}% + %\psframe[linewidth=0pt](0,0)(\tmplx,\tmply)% +\ifthenelse{\boolean{withindices}} +{\setcounter{tmpc}{0}% + \xpositionmarks{tmpc}{\value{boardcol}}% + \setcounter{tmpc}{0}% + \ypositionmarks{tmpc}{\value{boardcol}}% +}{\relax}% +\pspolygon[fillstyle=solid,linewidth=.5pt](2.5\baoxunit,1.6\baoyunit)% Nyumba + (2.5\baoxunit,2.4\baoyunit)% 2 + (3.5\baoxunit,2.4\baoyunit)% 3 + (3.5\baoxunit,1.6\baoyunit) % 4 quadrata +\pspolygon[fillstyle=solid,linewidth=.5pt](3.5\baoxunit,0.6\baoyunit)% Nyumba + (3.5\baoxunit,1.4\baoyunit)% 2 + (4.5\baoxunit,1.4\baoyunit)% 3 + (4.5\baoxunit,0.6\baoyunit) % 4 quadrata +% granai +\pspolygon[linearc=.5\baoxunit,linewidth=.5pt](-1.6\baoxunit,1.6\baoyunit)% + (-1.6\baoxunit,3.4\baoyunit)% + (-0.7\baoxunit,3.4\baoyunit)% + (-0.7\baoxunit,1.6\baoyunit)% +\pspolygon[linearc=.5\baoxunit,linewidth=.5pt](7.7\baoxunit,-0.4\baoyunit)% + (7.7\baoxunit,1.4\baoyunit)% + (8.6\baoxunit,1.4\baoyunit)% + (8.6\baoxunit,-0.4\baoyunit)% +\begin{baomoves} + \ifnum \value{nvi}>0 {\seeds{\arabic{nvi}}{n}{1}}{}\fi% + \ifnum \value{nvxxxiv}>0 {\seeds{\arabic{nvxxxiv}}{s}{1}}{}\fi% + \ifnum \value{nvii}>0 {\seeds{\arabic{nvii}}{b}{8}}{}\fi% + \ifnum \value{nviii}>0 {\seeds{\arabic{nviii}}{b}{7}}{}\fi% + \ifnum \value{nviv}>0 {\seeds{\arabic{nviv}}{b}{6}}{}\fi% + \ifnum \value{nvv}>0 {\seeds{\arabic{nvv}}{b}{5}}{}\fi% + \ifnum \value{nvvi}>0 {\seeds{\arabic{nvvi}}{b}{4}}{}\fi% + \ifnum \value{nvvii}>0 {\seeds{\arabic{nvvii}}{b}{3}}{}\fi% + \ifnum \value{nvviii}>0 {\seeds{\arabic{nvviii}}{b}{2}}{}\fi% + \ifnum \value{nvix}>0 {\seeds{\arabic{nvix}}{b}{1}}{}\fi% + \ifnum \value{nvx}>0 {\seeds{\arabic{nvx}}{a}{8}}{}\fi% + \ifnum \value{nvxi}>0 {\seeds{\arabic{nvxi}}{a}{7}}{}\fi% + \ifnum \value{nvxii}>0 {\seeds{\arabic{nvxii}}{a}{6}}{}\fi% + \ifnum \value{nvxiii}>0 {\seeds{\arabic{nvxiii}}{a}{5}}{}\fi% + \ifnum \value{nvxiv}>0 {\seeds{\arabic{nvxiv}}{a}{4}}{}\fi% + \ifnum \value{nvxv}>0 {\seeds{\arabic{nvxv}}{a}{3}}{}\fi% + \ifnum \value{nvxvi}>0 {\seeds{\arabic{nvxvi}}{a}{2}}{}\fi% + \ifnum \value{nvxvii}>0 {\seeds{\arabic{nvxvii}}{a}{1}}{}\fi% + \ifnum \value{nvxviii}>0 {\seeds{\arabic{nvxviii}}{A}{1}}{}\fi% + \ifnum \value{nvxix}>0 {\seeds{\arabic{nvxix}}{A}{2}}{}\fi% + \ifnum \value{nvxx}>0 {\seeds{\arabic{nvxx}}{A}{3}}{}\fi% + \ifnum \value{nvxxi}>0 {\seeds{\arabic{nvxxi}}{A}{4}}{}\fi% + \ifnum \value{nvxxii}>0 {\seeds{\arabic{nvxxii}}{A}{5}}{}\fi% + \ifnum \value{nvxxiii}>0 {\seeds{\arabic{nvxxiii}}{A}{6}}{}\fi% + \ifnum \value{nvxxiv}>0 {\seeds{\arabic{nvxxiv}}{A}{7}}{}\fi% + \ifnum \value{nvxxv}>0 {\seeds{\arabic{nvxxv}}{A}{8}}{}\fi% + \ifnum \value{nvxxvi}>0 {\seeds{\arabic{nvxxvi}}{B}{1}}{}\fi% + \ifnum \value{nvxxvii}>0 {\seeds{\arabic{nvxxvii}}{B}{2}}{}\fi% + \ifnum \value{nvxxviii}>0 {\seeds{\arabic{nvxxviii}}{B}{3}}{}\fi% + \ifnum \value{nvxxix}>0 {\seeds{\arabic{nvxxix}}{B}{4}}{}\fi% + \ifnum \value{nvxxx}>0 {\seeds{\arabic{nvxxx}}{B}{5}}{}\fi% + \ifnum \value{nvxxxi}>0 {\seeds{\arabic{nvxxxi}}{B}{6}}{}\fi% + \ifnum \value{nvxxxii}>0 {\seeds{\arabic{nvxxxii}}{B}{7}}{}\fi% + \ifnum \value{nvxxxiii}>0 {\seeds{\arabic{nvxxxiii}}{B}{8}}{}\fi% +}% +{ +\end{baomoves}% + \endpsclip% + \end{pspicture}% +}% + +\newenvironment{showbaoboard}[1][8]{% + \begin{psbaopartialboard}[8]{(0,0)(8,4)}% +} +{% + \end{psbaopartialboard}% +} +\newcommand{\nomark}{\relax}% +\newcommand{\factor}{0.28284271247461901}% = 2/5 * sin(1/4 * pi) +\newcommand{\markma}{% + \psline[linewidth=1.4pt](-\factor,-\factor)(\factor,\factor)% + \psline[linewidth=1.4pt](-\factor,\factor)(\factor,-\factor)% +} +\newcommand{\marksx}{% + \rput(-.5\baoxunit,0)% + {% + \psline[linewidth=1.4pt](.5\baoxunit,-.5\baoxunit) + \psline[linewidth=1.4pt](.5\baoxunit,.5\baoxunit) + %\pstriangle(-.1\baoxunit,0.1\baoxunit)% + }% +}% +\newcommand{\markdx}{% + \rput(.5\baoxunit,0)% + {% + \psline(-.5\baoxunit,-.5\baoxunit) + \psline(-.5\baoxunit,.5\baoxunit) + %\pstriangle(-.1\baoxunit,0.1\baoxunit)% + }% +}% +\newcommand{\marksl}{% +\psframe[fillstyle=solid,fillcolor=gray,linecolor=gray](-0.22\baoxunit,-0.22\baoxunit)(0.22\baoxunit,0.22\baoxunit)% +}% +\newcommand{\markdd}{% + \psframe[dimen=middle,% + fillstyle=vlines,% + hatchsep=2pt,% + hatchwidth=0.4pt,% + hatchangle=0,% + linestyle=none]% + (-0.6\baoxunit,-0.5\baoyunit)(0.5\baoxunit,0.5\baoyunit)% +}% + +\newcommand{\markss}{% + \psframe[dimen=middle,% + fillstyle=hlines,% + hatchsep=2pt,% + hatchwidth=0.6pt,% + hatchangle=0,% + linestyle=none]% + (-0.5\baoxunit,-0.5\baoyunit)(0.5\baoxunit,0.5\baoyunit)% +}% + +\newcommand{\seeds}[1]{% + \setlength{\tmply}{-0.5\baoxunit + 0.5ex}% + \raisebox{\tmply}{\psset{unit=\baoxunit}% + \begin{pspicture}(-0.5,-0)(0.5,1)% +\rput(0,0.5){{\psset{linecolor=white,unit=0.5}\color{white}\baolabelformat{#1}}}% + \end{pspicture}} +}% + +\newcommand{\baosit}[1][22,% + 0,0,0,0,0,0,0,0,% + 0,2,2,6,0,0,0,0,% + 0,0,0,0,6,2,2,0,% + 0,0,0,0,0,0,0,0,% + 22]{% +\liststore{#1}{bc} +\begin{showbaoboard} + \ifnum \bci>0 {\seeds{\bci}{n}{1}}{}\fi% + \ifnum \bcii>0 {\seeds{\bcii}{b}{8}}{}\fi% + \ifnum \bciii>0 {\seeds{\bciii}{b}{7}}{}\fi% + \ifnum \bciv>0 {\seeds{\bciv}{b}{6}}{}\fi% + \ifnum \bcv>0 {\seeds{\bcv}{b}{5}}{}\fi% + \ifnum \bcvi>0 {\seeds{\bcvi}{b}{4}}{}\fi% + \ifnum \bcvii>0 {\seeds{\bcvii}{b}{3}}{}\fi% + \ifnum \bcviii>0 {\seeds{\bcviii}{b}{2}}{}\fi% + \ifnum \bcix>0 {\seeds{\bcix}{b}{1}}{}\fi% + \ifnum \bcx>0 {\seeds{\bcx}{a}{8}}{}\fi% + \ifnum \bcxi>0 {\seeds{\bcxi}{a}{7}}{}\fi% + \ifnum \bcxii>0 {\seeds{\bcxii}{a}{6}}{}\fi% + \ifnum \bcxiii>0 {\seeds{\bcxiii}{a}{5}}{}\fi% + \ifnum \bcxiv>0 {\seeds{\bcxiv}{a}{4}}{}\fi% + \ifnum \bcxv>0 {\seeds{\bcxv}{a}{3}}{}\fi% + \ifnum \bcxvi>0 {\seeds{\bcxvi}{a}{2}}{}\fi% + \ifnum \bcxvii>0 {\seeds{\bcxvii}{a}{1}}{}\fi% + \ifnum \bcxviii>0 {\seeds{\bcxviii}{A}{1}}{}\fi% + \ifnum \bcxix>0 {\seeds{\bcxix}{A}{2}}{}\fi% + \ifnum \bcxx>0 {\seeds{\bcxx}{A}{3}}{}\fi% + \ifnum \bcxxi>0 {\seeds{\bcxxi}{A}{4}}{}\fi% + \ifnum \bcxxii>0 {\seeds{\bcxxii}{A}{5}}{}\fi% + \ifnum \bcxxiii>0 {\seeds{\bcxxiii}{A}{6}}{}\fi% + \ifnum \bcxxiv>0 {\seeds{\bcxxiv}{A}{7}}{}\fi% + \ifnum \bcxxv>0 {\seeds{\bcxxv}{A}{8}}{}\fi% + \ifnum \bcxxvi>0 {\seeds{\bcxxvi}{B}{1}}{}\fi% + \ifnum \bcxxvii>0 {\seeds{\bcxxvii}{B}{2}}{}\fi% + \ifnum \bcxxviii>0 {\seeds{\bcxxviii}{B}{3}}{}\fi% + \ifnum \bcxxix>0 {\seeds{\bcxxix}{B}{4}}{}\fi% + \ifnum \bcxxx>0 {\seeds{\bcxxx}{B}{5}}{}\fi% + \ifnum \bcxxxi>0 {\seeds{\bcxxxi}{B}{6}}{}\fi% + \ifnum \bcxxxii>0 {\seeds{\bcxxxii}{B}{7}}{}\fi% + \ifnum \bcxxxiii>0 {\seeds{\bcxxxiii}{B}{8}}{}\fi% + \ifnum \bcxxxiv>0 {\seeds{\bcxxxiv}{s}{1}}{}\fi% +\end{showbaoboard} +} + +\newcommand{\weka}[3]{% +% \kete[\stmark]{##2}{\conx{##2}{##3}}% + % Here should be used the macro \conx + \newcount\nord + \newcount\b + \b=#3 + \if #2b + \nord=10 + \advance \nord by -\b + \setcounter{nv\romannumeral\nord}{#1}% + \else + \if #2a + \nord=18 + \advance \nord by -\b + \setcounter{nv\romannumeral\nord}{#1}% + \else + \if #2A + \nord=17 + \advance \nord by \b + \setcounter{nv\romannumeral\nord}{#1}% + \else + \if #2B + \nord=25 + \advance \nord by \b + \setcounter{nv\romannumeral\nord}{#1}% + \else + \ifx #2S + \setcounter{nvxxxiv}{#1} + \else + \ifx #2s + \setcounter{nvxxxiv}{#1} + \else + \setcounter{nvi}{#1}% + \fi + \fi + \fi + \fi + \fi + \fi +} |