summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/psbao
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-11 00:12:59 +0000
committerKarl Berry <karl@freefriends.org>2008-11-11 00:12:59 +0000
commita9c51408c0b144d5b488b82be2ccff9cdab1a98c (patch)
tree6038ca6bffcbe30acb43b13f038beff6f667fd58 /Master/texmf-dist/tex/latex/psbao
parentc13aeb762078cf6383244d7b1b4ebc7fbb0ad09e (diff)
new latex package psbao (10nov08)
git-svn-id: svn://tug.org/texlive/trunk@11249 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/psbao')
-rw-r--r--Master/texmf-dist/tex/latex/psbao/psbao.sty730
1 files changed, 730 insertions, 0 deletions
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
+}