%%
%% This is file `chessboard-pgf.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% chessboard.dtx  (with options: `chessboard-pgf')
%% 
%% chessboard: a package to print chessboards
%% Copyright 2006-2019 Ulrike Fischer (chess@nililand.de)
%% -------------------------------------------
%% 
%% This file can be redistributed and/or modified under the terms of
%% the LaTeX Project Public License distributed from CTAN archives in
%% the directory macros/latex/base/lppl.txt; either version 1 of the
%% License, or (at your option) any later version.
%% 
%% For error reports see documentation.
\ProvidesFile{chessboard-pgf.sty}[2019/06/23 version v1.8 pgf code for chessboard.sty]
%%$Date: 2011/01/11 14:07:20 $$Version: 3d9f59c743f1 $

\newcommand\board@pgf@extrabackground{}%
\newcommand\board@pgf@extramarkground{}%

\newcommand\board@pgf@addbackground[1]{%#1 commands,
   \expandafter\board@do@l@addto@macro\csname board@pgf@extrabackground\endcsname{#1}}%

\newcommand\board@pgf@addmarkground[1]{%#1 commands
   \expandafter\board@do@l@addto@macro\csname board@pgf@extramarkground\endcsname{#1}}%

%% saving the markstyles with option

\newcommand\board@do@savemarkstyle{%
    \@ifnextchar[\board@do@savemarkstylewithopt\board@do@savemarkstylenoopt}%

\def\board@do@savemarkstylewithopt[#1]#2ARGEND{%
  \def\board@pgf@curstyleopt{#1}%
  \def\board@pgf@curmarkstyle{#2}%added 2007.08.15
  \board@pgf@addmarkground{%
    \def\board@pgf@curmarkstyle{#2}%
    \def\board@pgf@curstyleopt{#1}}}%

\def\board@do@savemarkstylenoopt#1ARGEND{%
  \def\board@pgf@curstyleopt{}%added 2007.08.15
  \def\board@pgf@curmarkstyle{#1}%
  \board@pgf@addmarkground{%
   \def\board@pgf@curstyleopt{}%
   \def\board@pgf@curmarkstyle{#1}}}%

%% saving the backstyle with option
\newcommand\board@do@savebackstyle{%
    \@ifnextchar[\board@do@savebackstylewithopt\board@do@savebackstylenoopt}%

\def\board@do@savebackstylewithopt[#1]#2ARGEND{%
  \def\board@pgf@curstyleopt{#1}%
  \board@pgf@addbackground{%
    \def\board@pgf@curbackstyle{#2}%
    \def\board@pgf@curstyleopt{#1}}}%

\def\board@do@savebackstylenoopt#1ARGEND{%
  \def\board@pgf@curbackstyle{#1}%
  \board@pgf@addbackground{%
   \def\board@pgf@curstyleopt{}%
   \def\board@pgf@curbackstyle{#1}}}%

%% init/start pgf commands

\newcommand\board@pgf@clippath{}%

\newcommand\board@pgf@setunits{%
   \pgfsetxvec{\pgfpoint{\len@cfss@squarewidth}{0cm}}%
   \pgfsetyvec{\pgfpoint{0cm}{\len@cfss@squaretotalheight}}%
   \pgfpathrectangle{\pgfpointorigin}{\pgfpointorigin}%
   \pgfusepath{use as bounding box}}%

\newcommand\board@pgf@addnode[2]{%#1= node name =field name, #2=mark or back
 \expandafter\board@do@l@addto@macro\csname board@pgf@#2ground\endcsname{%
   \pgfnode{coordinate}{center}{}{#1}{}{}%
   \pgfusepath{fill}}}%

\newcommand\board@pgf@gotonode[2]{% #1= node name =field name #2=mark or back
 \expandafter\board@do@l@addto@macro\csname board@pgf@#2ground\endcsname{%
  \pgftransformshift{\pgfpointanchor{#1}{center}}}}%

\newcommand\board@pgf@setanchors[1]{% #1= mark or back
 \setcounter{cnt@board@rank}{0}%
 \setcounter{cnt@board@file}{0}%
 \whiledo %nodes for files
  {\value{cnt@board@file}<\numexpr\board@val@maxfilenum+1\relax}%
  {\setcounter{cnt@board@rank}{0}%
   \whiledo %nodes for on one field for each rank
    {\value{cnt@board@rank}<\numexpr\board@val@maxranknum+1\relax}%
    {\edef\board@temp{\zeroalph{cnt@board@file}\number\value{cnt@board@rank}}%
     \expandafter\board@pgf@addnode\expandafter{\board@temp}{#1}%
     \expandafter\board@do@l@addto@macro\csname board@pgf@#1ground\endcsname{%
       \pgftransformshift{\pgfpointxy{0}{1}}}%
     \addtocounter{cnt@board@rank}{1}}%
   \edef\board@temp{\zeroalph{cnt@board@file}0}%
   \expandafter\board@pgf@gotonode\expandafter{\board@temp}{#1}%
   \addtocounter{cnt@board@file}{1}%
  \expandafter\board@do@l@addto@macro\csname board@pgf@#1ground\endcsname{% one to the right
    \pgftransformshift{\pgfpointxy{1}{0}}}}%
  \expandafter\board@do@l@addto@macro\csname board@pgf@#1ground\endcsname{%
    \csname board@pgf@#1clippath\endcsname}}%

\newcommand\board@pgf@init{%
  \def\board@pgf@background{%
   \board@pgf@setunits
   \ifUFCB@locset@inverse
    \pgftransformshift{\pgfpointxy{\board@val@stopprintfilenum}{\board@val@startprintranknum}}%
    \pgftransformshift{\pgfpointxy{0.5}{0.5}}%
    \pgftransformrotate{180}%
   \else
    \pgftransformshift{\pgfpointxy{-\board@val@startprintfilenum}{-\board@val@stopprintranknum}}%
    \pgftransformshift{\pgfpointxy{0.5}{0.5}}%
   \fi}%
   \board@pgf@setanchors{back}%
  %
  \def\board@pgf@markground{%
   \board@pgf@setunits
   \ifUFCB@locset@inverse
    \pgftransformshift{\pgfpointxy{\board@val@startprintfilenum}{\board@val@startprintranknum}}%
    \pgftransformshift{\pgfpointxy{-0.5}{0.5}}%
    \pgftransformrotate{180}%
   \else
    \pgftransformshift{\pgfpointxy{-\board@val@stopprintfilenum}{-\board@val@stopprintranknum}}%
    \pgftransformshift{\pgfpointxy{-0.5}{0.5}}%
   \fi}%
   \board@pgf@setanchors{mark}}%

%% getting angles/length of a point:

\newcommand\board@pgf@extractangle[2]{%#1 command, #2 pgfpoint
   \pgfextracty{\len@board@tempy}{#2}%
   \pgfextractx{\len@board@tempx}{#2}%
  \ifdim\len@board@tempx=0pt\relax
  %\len@board@tempy= 1 or unchanged?
  \else
   \divide \len@board@tempy by \strip@pt\len@board@tempx\relax
  \fi
   \ifdim\len@board@tempx=0pt\relax
     \ifdim\len@board@tempy=0pt\relax
      \def#1{0}%
     \else
      \ifdim\len@board@tempy>0pt\relax
       \def#1{90}%
      \else
       \def#1{-90}%
      \fi
     \fi
   \fi
   \ifdim\len@board@tempy=0pt\relax
    \ifdim\len@board@tempx=0pt\relax
      \def#1{0}%
    \else
      \ifdim\len@board@tempx>0pt\relax
       \def#1{0}%
      \else
       \def#1{180}%
      \fi
    \fi
   \fi
   \ifdim\len@board@tempx>0pt\relax
    \ifdim\len@board@tempy>0pt\relax
     \pgfmathatan{\len@board@tempy}%
     \edef#1{\pgfmathresult}%
    \fi
    \ifdim\len@board@tempy<0pt\relax
     \pgfmathatan{\len@board@tempy}%
     \edef#1{\pgfmathresult}%
    \fi
  \fi
  \ifdim\len@board@tempx<0pt\relax
    \ifdim\len@board@tempy>0pt\relax
     \pgfmathatan{-\len@board@tempy}%
     \pgfmathadd{-\pgfmathresult}{180}%
     \edef#1{\pgfmathresult}%
    \fi
    \ifdim\len@board@tempy<0pt\relax
     \pgfmathatan{\len@board@tempy}%
     \pgfmathadd{\pgfmathresult}{180}%
     \edef#1{\pgfmathresult}%
    \fi
  \fi
   }

\newcommand\board@pgf@extractlength[2]{%#1 length, #2 pgfpoint
   \pgfextracty{\len@board@tempy}{#2}%
   \pgfextractx{\len@board@tempx}{#2}%
   \pgfmathveclen{\len@board@tempx}{\len@board@tempy}%
   #1=\pgfmathresult pt\relax}

%% Field decoration:
%%  The command called by the markarea-key

\newcommand*\board@pgf@add@fieldmarkstyletoarea[1]{% #1 =area
 \expandafter\board@split@areasort#1ARGEND%
 %% initialisation
 \setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
 \setcounter{cnt@board@rank}{\board@temp@curstartranknum}%
 %
 \whiledo
  {\value{cnt@board@rank}>\numexpr \board@temp@curstopranknum-1\relax}%
  {\setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
   \whiledo
    {\value{cnt@board@file}<\numexpr \board@temp@curstopfilenum+1\relax}%
    {\edef\board@temp@curfield{\zeroalph{cnt@board@file}\number\value{cnt@board@rank}}%
     \expandafter\board@pgf@addpgftofield\expandafter{\board@temp@curfield}{mark}%
     \addtocounter{cnt@board@file}{1}}%
   \addtocounter{cnt@board@rank}{-1}}}%

%% The command called by the backarea-key

\newcommand*\board@pgf@add@fieldbackstyletoarea[1]{% #1 =area
 \expandafter\board@split@areasort#1ARGEND%
 %% initialisation
 \setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
 \setcounter{cnt@board@rank}{\board@temp@curstartranknum}%
 %
 \whiledo
  {\value{cnt@board@rank}>\numexpr \board@temp@curstopranknum-1\relax}%
  {\setcounter{cnt@board@file}{\board@temp@curstartfilenum}%
   \whiledo
    {\value{cnt@board@file}<\numexpr \board@temp@curstopfilenum+1\relax}%
    {\edef\board@temp@curfield{\zeroalph{cnt@board@file}\number\value{cnt@board@rank}}%
     \expandafter\board@pgf@addpgftofield\expandafter{\board@temp@curfield}{back}%
     \addtocounter{cnt@board@file}{1}}%
   \addtocounter{cnt@board@rank}{-1}}}%

%% The command that puts the code in the picture.
\newcommand\board@pgf@addpgftofield[2]{%  #1= node name =field name, #2=mark or back
 \expandafter\board@split@field #1ARGEND%
 \ifthenelse%
  {\board@test@isfieldintrimarea{\board@temp@curfilenum}{\board@temp@curranknum}\AND
   \board@test@isonactivecolor{\board@temp@curfilenum}{\board@temp@curranknum}}%
  {\ifcsname board@pgf@fieldstyle\csname board@pgf@cur#2style\endcsname\endcsname
    \csname board@pgf@add#2ground\endcsname{%
    \def\currentarea{#1}%
    \def\currentbq{#1}%
    \def\currentbk{#1}%
    \def\currentwq{#1}%
    \def\currentwk{#1}%
    \def\currentfrom{#1}%
    \def\currentto{#1}%
     \pgftransformshift{\pgfpointanchor{#1}{center}}%
     \expandafter\let\expandafter\board@pgf@curpgfstyle
       \csname board@pgf@fieldstyle\csname board@pgf@cur#2style\endcsname\endcsname
     \edef\next{\noexpand\board@pgf@curpgfstyle
          {#1}%
          {\unexpanded\expandafter{\board@pgf@curstyleopt}}}%
     \next}%
  \else
   \PackageWarning{chessboard}%
     {#2 style '\csname board@pgf@cur#2style\endcsname'  not defined for fields!
      I will ignore the #2 commands}%
  \fi}%
  {}}%

%% Region decoration

\def\board@pgf@backclipleftpadding{0pt}
\def\board@pgf@backcliptoppadding{0pt}
\def\board@pgf@backcliprightpadding{0pt}
\def\board@pgf@backclipbottompadding{0pt}
\def\board@pgf@markclipleftpadding{0pt}
\def\board@pgf@markcliptoppadding{0pt}
\def\board@pgf@markcliprightpadding{0pt}
\def\board@pgf@markclipbottompadding{0pt}
\def\board@pgf@usebackclippath{discard}
\def\board@pgf@usemarkclippath{discard}

\def\board@pgf@markclippath{%
   \pgfusepath{}%
   \pgfpathrectanglecorners%
    {\pgfpointadd%
      {\pgfpointanchor{\board@val@stopprintfilechar\board@val@startprintranknum}{center}}%
      {\pgfpointadd
        {\pgfpointxy{0.5}{0.5}}%
        {\pgfpoint{\board@pgf@markcliprightpadding}{\board@pgf@markcliptoppadding}}%
      }}%
    {\pgfpointadd%
      {\pgfpointanchor{\board@val@startprintfilechar\board@val@stopprintranknum}{center}}%
      {\pgfpointadd
        {\pgfpointxy{-0.5}{-0.5}}
        {\pgfpoint{-\board@pgf@markclipleftpadding}{-\board@pgf@markclipbottompadding}}%
      }%
    }%
   \pgfusepath{\board@pgf@usemarkclippath}}

\def\board@pgf@backclippath{%
   \pgfusepath{}%
   \pgfpathrectanglecorners%
    {\pgfpointadd%
      {\pgfpointanchor{\board@val@stopprintfilechar\board@val@startprintranknum}{center}}%
      {\pgfpointadd
        {\pgfpointxy{0.5}{0.5}}%
        {\pgfpoint{\board@pgf@backcliprightpadding}{\board@pgf@backcliptoppadding}}%
      }}%
    {\pgfpointadd%
      {\pgfpointanchor{\board@val@startprintfilechar\board@val@stopprintranknum}{center}}%
      {\pgfpointadd
        {\pgfpointxy{-0.5}{-0.5}}
        {\pgfpoint{-\board@pgf@backclipleftpadding}{-\board@pgf@backclipbottompadding}}%
      }%
    }%
   \pgfusepath{\board@pgf@usebackclippath}}

%% the command called by the markregion key
%% the command puts the code directly in the pgf as no loop needed

\newcommand\board@pgf@add@regionmarkstyle[2]{% #1=startfield (e.g. a8), #2=stopfield (e.g.h1)
 \expandafter\board@split@areasort#1-#2ARGEND%
 \ifthenelse%
  {\board@test@isareaintrimarea
   {\board@temp@curstartfilenum}{\board@temp@curstartranknum}%
   {\board@temp@curstopfilenum}{\board@temp@curstopranknum}}%
  {\ifcsname board@pgf@regionstyle\board@pgf@curmarkstyle\endcsname
    \board@pgf@addmarkground{%
    \def\currentarea{#1-#2}%
    \expandafter\board@split@areasort#1-#2ARGEND%
    \edef\currentbq{\board@temp@curstartfilechar\board@temp@curstartranknum}%
    \edef\currentbk{\board@temp@curstopfilechar\board@temp@curstartranknum}%
    \edef\currentwq{\board@temp@curstartfilechar\board@temp@curstopranknum}%
    \edef\currentwk{\board@temp@curstopfilechar\board@temp@curstopranknum}%
    \def\currentfrom{#1}%
    \def\currentto{#2}%
    \pgftransformshift{\pgfpointanchor{#1}{center}}%
    \expandafter\let\expandafter\board@pgf@curpgfstyle
       \csname board@pgf@regionstyle\csname board@pgf@curmarkstyle\endcsname\endcsname
    \edef\next{\noexpand\board@pgf@curpgfstyle
          {#2}%
          {\unexpanded\expandafter{\board@pgf@curstyleopt}}}%
    \next
    %\csname board@pgf@regionstyle\board@pgf@curmarkstyle\endcsname{#2}%
    }%
  \else
   \PackageWarning{chessboard}%
     {mark style '\board@pgf@curmarkstyle'  not defined for regions!
      I will ignore the mark commands}%
  \fi}{}}%

%% the command called by the backregion key
%% the command puts the code directly in the pgf as no loop needed

\newcommand\board@pgf@add@regionbackstyle[2]{% #1=startfield (e.g. a8), #2=stopfield (e.g.h1)
 \expandafter\board@split@areasort#1-#2ARGEND%
 \ifthenelse%
  {\board@test@isareaintrimarea
   {\board@temp@curstartfilenum}{\board@temp@curstartranknum}%
   {\board@temp@curstopfilenum}{\board@temp@curstopranknum}}%
  {\ifcsname board@pgf@regionstyle\board@pgf@curbackstyle\endcsname
   \board@pgf@addbackground{%
    \def\currentarea{#1-#2}%
    \expandafter\board@split@areasort#1-#2ARGEND%
    \edef\currentbq{\board@temp@curstartfilechar\board@temp@curstartranknum}%
    \edef\currentbk{\board@temp@curstopfilechar\board@temp@curstartranknum}%
    \edef\currentwq{\board@temp@curstartfilechar\board@temp@curstopranknum}%
    \edef\currentwk{\board@temp@curstopfilechar\board@temp@curstopranknum}%
    \def\currentfrom{#1}%
    \def\currentto{#2}%
    \pgftransformshift{\pgfpointanchor{#1}{center}}%
    \expandafter\let\expandafter\board@pgf@curpgfstyle
       \csname board@pgf@regionstyle\csname board@pgf@curbackstyle\endcsname\endcsname
    \edef\next{\noexpand\board@pgf@curpgfstyle
          {#2}%
          {\unexpanded\expandafter{\board@pgf@curstyleopt}}}%
    \next}%
  \else
   \PackageWarning{chessboard}%
     {back style '\board@pgf@curbackstyle'  not defined for regions!
      I will ignore the back commands}%
  \fi}{}}%

%% Move decoration
%% the command called by the markmove key
%% the command put the code directly in the pgf as no loop needed

\newcommand\board@pgf@add@movemarkstyle[2]{% #1=from field, #2=to field.
 \expandafter\board@split@areasort#1-#2ARGEND%
 \ifthenelse%
  {\board@test@isareaintrimarea
   {\board@temp@curstartfilenum}{\board@temp@curstartranknum}%
   {\board@temp@curstopfilenum}{\board@temp@curstopranknum}}%
  {\ifcsname board@pgf@movestyle\board@pgf@curmarkstyle\endcsname
   \board@pgf@addmarkground{%
    \def\currentarea{#1-#2}%
    \expandafter\board@split@areasort#1-#2ARGEND%
    \edef\currentbq{\board@temp@curstartfilechar\board@temp@curstartranknum}%
    \edef\currentbk{\board@temp@curstopfilechar\board@temp@curstartranknum}%
    \edef\currentwq{\board@temp@curstartfilechar\board@temp@curstopranknum}%
    \edef\currentwk{\board@temp@curstopfilechar\board@temp@curstopranknum}%
    \def\currentfrom{#1}%
    \def\currentto{#2}%
    \pgftransformshift{\pgfpointanchor{#1}{center}}%
    \expandafter\let\expandafter\board@pgf@curpgfstyle
       \csname board@pgf@movestyle\csname board@pgf@curmarkstyle\endcsname\endcsname
    \edef\next{\noexpand\board@pgf@curpgfstyle
          {#2}%
          {\unexpanded\expandafter{\board@pgf@curstyleopt}}}%
    \next
    }%
  \else
   \PackageWarning{chessboard}%
     {mark style '\board@pgf@curmarkstyle'  not defined for moves!
      I will ignore the mark commands}%
  \fi}{}}%

%% the command called by the backmove key
%% the command put the code directly in the pgf as no loop needed

\newcommand\board@pgf@add@movebackstyle[2]{% #1=from field, #2=to field.
 \expandafter\board@split@areasort#1-#2ARGEND%
 \ifthenelse%
  {\board@test@isareaintrimarea
   {\board@temp@curstartfilenum}{\board@temp@curstartranknum}%
   {\board@temp@curstopfilenum}{\board@temp@curstopranknum}}%
  {\ifcsname board@pgf@movestyle\board@pgf@curbackstyle\endcsname
   \board@pgf@addbackground{%
   \def\currentarea{#1-#2}%
    \def\currentarea{#1-#2}%
    \expandafter\board@split@areasort#1-#2ARGEND%
    \edef\currentbq{\board@temp@curstartfilechar\board@temp@curstartranknum}%
    \edef\currentbk{\board@temp@curstopfilechar\board@temp@curstartranknum}%
    \edef\currentwq{\board@temp@curstartfilechar\board@temp@curstopranknum}%
    \edef\currentwk{\board@temp@curstopfilechar\board@temp@curstopranknum}%
    \def\currentfrom{#1}%
    \def\currentto{#2}%
    \pgftransformshift{\pgfpointanchor{#1}{center}}%
    \expandafter\let\expandafter\board@pgf@curpgfstyle
       \csname board@pgf@movestyle\csname board@pgf@curbackstyle\endcsname\endcsname
    \edef\next{\noexpand\board@pgf@curpgfstyle
          {#2}%
          {\unexpanded\expandafter{\board@pgf@curstyleopt}}}%
    \next
    }%
  \else
   \PackageWarning{chessboard}%
     {back style '\board@pgf@curbackstyle'  not defined for moves!
      I will ignore the back commands}%
  \fi}{}}%

%%% User command to define pgf styles
\newcommand\cbDefinePgfFieldStyle[2]{%#1=name, #2=pgf-commands
  \expandafter\def\csname board@pgf@fieldstyle#1\endcsname##1##2{% ##1=field
    \begin{pgfscope}%                                            % ##2=options
     #2
    \end{pgfscope}}}%

\newcommand\cbDefinePgfRegionStyle[2]{%#1=name, #2=pgf-commands
  \expandafter\def\csname board@pgf@regionstyle#1\endcsname##1##2{% ##1=oposite corner
    \begin{pgfscope}%                                             % ##2=options
     #2
    \end{pgfscope}}}%

\newcommand\cbDefinePgfMoveStyle[2]{%#1=name, #2=pgf-commands
  \expandafter\def\csname board@pgf@movestyle#1\endcsname##1##2{% ##1 =to corner
    \begin{pgfscope}%                                           % ##2 = options
     #2
    \end{pgfscope}}}%

\let\cbDefineMarkFieldStyle\cbDefinePgfFieldStyle
\let\cbDefineMarkRegionStyle\cbDefinePgfRegionStyle
\let\cbDefineMarkMoveStyle\cbDefinePgfMoveStyle

%%% some predefined pgf styles

%% style none,  don't know if useful

\cbDefinePgfFieldStyle{none}{\pgfusepath{discard}}%
\cbDefinePgfRegionStyle{none}{\pgfusepath{discard}}%
\cbDefinePgfMoveStyle{none}{\pgfusepath{discard}}%

%% moves
\cbDefinePgfMoveStyle{straightmove}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \setlength\len@board@tempx{\dimexpr 0.1em + \board@pgf@shortenstart \relax}%
    \pgfsetshortenstart{\len@board@tempx}%
    \setlength\len@board@tempx{\board@pgf@shortenend}%
    \pgfsetshortenend{\len@board@tempx}%
    \pgfsetarrowsend{\board@pgf@arrow}%
    \pgfsetroundcap
    \pgfpathmoveto{\pgfpointorigin}%
    \pgfpathlineto{\pgfpointanchor{#1}{center}}%
    \pgfusepath{stroke}}%

\cbDefinePgfMoveStyle{knightmove}{%
   \pgfsetlinewidth{\board@pgf@linewidth}%
   \pgfsetarrowsend{\board@pgf@arrow}%
   \setlength\len@board@tempx{\dimexpr 0.3em + \board@pgf@shortenstart \relax}%
   \pgfsetshortenstart{\len@board@tempx}%
   \setlength\len@board@tempx{\board@pgf@shortenend}%
   \pgfsetshortenend{\len@board@tempx}%
   \pgfextractx{\len@board@tempx}{\pgfpointanchor{#1}{center}}%
   \pgfextracty{\len@board@tempy}{\pgfpointanchor{#1}{center}}%
   \pgfpathmoveto{\pgfpointorigin}%
   \pgfpathcurveto%
    {\pgfpoint{0pt}{0.8\len@board@tempy}}%
    {\pgfpoint{0.2\len@board@tempx}{\len@board@tempy}}%
    {\pgfpointanchor{#1}{center}}%
   \pgfusepath{stroke}}%

\newcommand\board@pgf@curvemove[2][]{
 \setkeys[UFCB]{bez}{#1}%
 \pgfsetlinewidth{\board@pgf@linewidth}%
 \pgfsetarrowsend{\board@pgf@arrow}%
 \setlength\len@board@tempx{\dimexpr 0.3em + \board@pgf@shortenstart \relax}%
 \pgfsetshortenstart{\len@board@tempx}%
 \setlength\len@board@tempx{\board@pgf@shortenend}%
 \pgfsetshortenend{\len@board@tempx}%
 \board@pgf@extractangle{\board@temp@angle}{#2}%
 \board@pgf@extractlength{\len@board@tempy}{#2}%
 \pgftransformrotate{\board@temp@angle}%
 \pgfpathmoveto{\pgfpointorigin}%
 \pgfpathcurveto
  {\pgfpointadd{\pgfpoint{\board@val@bezxi*\len@board@tempy}{0cm}}%
               {\pgfpointxy{0}{\board@val@pgfsign*\board@val@bezyi}}}%
  {\pgfpointadd{\pgfpoint{\board@val@bezxii*\len@board@tempy}{0cm}}%
               {\pgfpointxy{0}{\board@val@pgfsign*\board@val@bezyii}}}%
  {\pgfpoint{\len@board@tempy}{0cm}}%
 \pgfusepath{stroke}%
}

\cbDefinePgfMoveStyle{curvemove}{%
    \board@pgf@curvemove[#2]{\pgfpointanchor{#1}{center}}}%

\def\board@pgf@curvemovestyle@knight{\setkeys[UFCB]{bez}{x1=1/2,x2=2/3,y1=0.5,y2=0.5}}
%% region

\cbDefinePgfRegionStyle{text}{%
 \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
 \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
 \pgftransformshift
  {\pgfpointintersectionoflines
     {\pgfpointxy{-0.5}{0.5}}%
     {\pgfpointadd
      {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
      {\pgfpointxy{0.5}{-0.5}}}%
     {\pgfpointadd
       {\pgfpoint{\len@board@tempx}{0pt}}%
       {\pgfpointxy{0.5}{0.5}}}%
     {\pgfpointadd
       {\pgfpoint{0pt}{\len@board@tempy}}%
       {\pgfpointxy{-0.5}{-0.5}}}}%
 \ifthenelse%
  {\boolean{\XKV@UFCB@locset@inverse@value}}%
  {\pgftext[rotate=180,#2]{\normalfont\board@pgf@curtext}}%
  {\pgftext[#2]{\normalfont\board@pgf@curtext}}}%

\cbDefinePgfRegionStyle{border}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfpathrectanglecorners%
      {\pgfpointadd%
       {\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}%
       {\pgfpointxy{-0.5}{0.5}}}%
      {\pgfpointadd%
       {\pgfpointanchor{#1}{center}}%
       {\pgfpointadd%
        {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}%
        {\pgfpointxy{0.5}{-0.5}}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{color}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfpathrectanglecorners%
      {\pgfpointadd%
       {\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}%
       {\pgfpointxy{-0.5}{0.5}}}%
      {\pgfpointadd%
       {\pgfpointanchor{#1}{center}}%
       {\pgfpointadd%
        {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}%
        {\pgfpointxy{0.5}{-0.5}}}}%
    \pgfusepath{fill}}%

\cbDefinePgfRegionStyle{leftborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{\len@board@tempy}}}%
    \pgfpathlineto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{0pt}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{topborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
    \pgfpathlineto{%
      \pgfpointadd{\pgfpointxy{0.5}{0.5}}{\pgfpoint{\len@board@tempx}{\board@pgf@padding}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{rightborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
    \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd
       {\pgfpointxy{0.5}{0.5}}%
       {\pgfpointadd
         {\pgfpoint{\len@board@tempx}{0pt}}%
         {\pgfpoint{\board@pgf@padding}{0pt}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
      {\pgfpointadd
       {\pgfpointxy{0.5}{-0.5}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{bottomborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
    \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd
      {\pgfpointanchor{#1}{center}}%
      {\pgfpointadd
       {\pgfpointxy{0.5}{-0.5}}%
       {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
      \pgfpointadd
       {\pgfpointxy{-0.5}{-0.5}}%
       {\pgfpointadd
         {\pgfpoint{0pt}{\len@board@tempy}}%
         {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
    %\pgfpathlineto{{-\board@pgf@padding}{\len@board@tempy}}%
    \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{lefttopborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
    \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{\len@board@tempy}}}%
    \pgfpathlineto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{0.5}}%
      {\pgfpoint{\len@board@tempx}{\board@pgf@padding}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{lefttoprightborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
    \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{\len@board@tempy}}}%
    \pgfpathlineto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{0.5}}%
      {\pgfpointadd
       {\pgfpoint{\len@board@tempx}{\board@pgf@padding}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{toprightborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
    \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{0.5}}%
      {\pgfpointadd
       {\pgfpoint{\len@board@tempx}{\board@pgf@padding}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}}%
       \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{toprightbottomborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
    \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{0.5}}%
      {\pgfpointadd
       {\pgfpoint{\len@board@tempx}{\board@pgf@padding}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
       {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{\len@board@tempy}}%
       {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
       \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{rightbottomborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
    \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd
       {\pgfpointxy{0.5}{0.5}}%
       {\pgfpointadd
         {\pgfpoint{\len@board@tempx}{0pt}}%
         {\pgfpoint{\board@pgf@padding}{0pt}}}}%
   \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
       {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{\len@board@tempy}}%
       {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{rightbottomleftborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
    \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd
       {\pgfpointxy{0.5}{0.5}}%
       {\pgfpointadd
         {\pgfpoint{\len@board@tempx}{0pt}}%
         {\pgfpoint{\board@pgf@padding}{0pt}}}}%
   \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
       {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{\len@board@tempy}}%
       {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{0.5}}%
      {\pgfpoint{-\board@pgf@padding}{0pt}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{bottomleftborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
    \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd
      {\pgfpointanchor{#1}{center}}%
      {\pgfpointadd
       {\pgfpointxy{0.5}{-0.5}}%
       {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{\len@board@tempy}}%
       {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{0.5}}%
      {\pgfpoint{-\board@pgf@padding}{0pt}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfRegionStyle{bottomlefttopborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
    \pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
    \pgfpathmoveto{%
     \pgfpointadd
      {\pgfpointanchor{#1}{center}}%
      {\pgfpointadd
       {\pgfpointxy{0.5}{-0.5}}%
       {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{\len@board@tempy}}%
       {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{0.5}}%
      {\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{0.5}}%
      {\pgfpoint{\len@board@tempx}{\board@pgf@padding}}}%
    \pgfusepath{stroke}}%

%% Fields
\cbDefinePgfFieldStyle{cross}{%
    \pgfsetroundcap
    \setlength\len@board@tempx{\dimexpr 0.1em + \board@pgf@shortenstart \relax}%
    \pgfsetshortenstart{\len@board@tempx}%
    \setlength\len@board@tempx{\dimexpr 0.1em + \board@pgf@shortenend \relax}%
    \pgfsetshortenend{\len@board@tempx}%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfpathmoveto{\pgfpointxy{0.5}{0.5}}%
    \pgfpathlineto{\pgfpointxy{-0.5}{-0.5}}%
    \pgfusepath{stroke}%
    \pgfpathmoveto{\pgfpointxy{-0.5}{0.5}}%
    \pgfpathlineto{\pgfpointxy{0.5}{-0.5}}%
    \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{circle}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \setlength\len@board@tempx{\dimexpr 0.55em + \board@pgf@padding \relax}%
    \pgfpathcircle{\pgfpointxy{0}{0}}{\len@board@tempx}%
    \pgfusepath{stroke,#2}}%

\cbDefinePgfFieldStyle{text}{%
    \ifthenelse%
     {\boolean{\XKV@UFCB@locset@inverse@value}}%
     {\pgftext[rotate=180,#2]{\normalfont\board@pgf@curtext}}%
     {\pgftext[#2]{\normalfont\board@pgf@curtext}}}%

\cbDefinePgfFieldStyle{border}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfpathrectanglecorners
      {\pgfpointadd%
       {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}%
       {\pgfpointxy{-0.5}{-0.5}}}%
      {\pgfpointadd%
       {\pgfpoint{\board@pgf@padding}{\board@pgf@padding}}%
       {\pgfpointxy{0.5}{0.5}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{color}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfpathrectanglecorners
     {\pgfpointadd%
       {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}%
       {\pgfpointxy{-0.5}{-0.5}}}%
      {\pgfpointadd%
       {\pgfpoint{\board@pgf@padding}{\board@pgf@padding}}%
       {\pgfpointxy{0.5}{0.5}}}%
    \pgfusepath{fill}}%

\cbDefinePgfFieldStyle{leftborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{0pt}}}%
    \pgfpathlineto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{0pt}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{topborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
    \pgfpathlineto{%
      \pgfpointadd{\pgfpointxy{0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{rightborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfpathmoveto{%
     \pgfpointadd
       {\pgfpointxy{0.5}{0.5}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}%
    \pgfpathlineto{%
     \pgfpointadd
       {\pgfpointxy{0.5}{-0.5}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{bottomborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfpathmoveto{%
     \pgfpointadd
       {\pgfpointxy{0.5}{-0.5}}%
       {\pgfpoint{0pt}{-\board@pgf@padding}}}%
    \pgfpathlineto{%
      \pgfpointadd
       {\pgfpointxy{-0.5}{-0.5}}%
       {\pgfpoint{0pt}{-\board@pgf@padding}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{lefttopborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{0pt}}}%
    \pgfpathlineto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{0.5}}%
      {\pgfpoint{0pt}{\board@pgf@padding}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{lefttoprightborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{-0.5}}{\pgfpoint{-\board@pgf@padding}{0pt}}}%
    \pgfpathlineto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{\board@pgf@padding}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{-0.5}}%
      {\pgfpoint{\board@pgf@padding}{0pt}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{toprightborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
     \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{\board@pgf@padding}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{0pt}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}}%
       \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{toprightbottomborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfpathmoveto{%
     \pgfpointadd{\pgfpointxy{-0.5}{0.5}}{\pgfpoint{0pt}{\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{\board@pgf@padding}}%
       {\pgfpoint{\board@pgf@padding}{0pt}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{0pt}}%
       {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{0pt}}%
       {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
       \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{rightbottomborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfpathmoveto{%
     \pgfpointadd
       {\pgfpointxy{0.5}{0.5}}%
       {\pgfpointadd
         {\pgfpoint{0pt}{0pt}}%
         {\pgfpoint{\board@pgf@padding}{0pt}}}}%
   \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{0pt}}%
       {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{0pt}}%
       {\pgfpoint{0pt}{-\board@pgf@padding}}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{rightbottomleftborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfpathmoveto{%
     \pgfpointadd
       {\pgfpointxy{0.5}{0.5}}%
       {\pgfpointadd
         {\pgfpoint{0pt}{0pt}}%
         {\pgfpoint{\board@pgf@padding}{0pt}}}}%
   \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{0pt}}%
       {\pgfpoint{\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{0pt}}%
       {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{0.5}}%
      {\pgfpoint{-\board@pgf@padding}{0pt}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{bottomleftborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfpathmoveto{%
     \pgfpointadd
       {\pgfpointxy{0.5}{-0.5}}%
       {\pgfpoint{0pt}{-\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{0pt}}%
       {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{0.5}}%
      {\pgfpoint{-\board@pgf@padding}{0pt}}}%
    \pgfusepath{stroke}}%

\cbDefinePgfFieldStyle{bottomlefttopborder}{%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfsetcornersarced{\pgfpoint{\board@pgf@corner}{\board@pgf@corner}}%
    \pgfsetshortenstart{\board@pgf@shortenstart}%
    \pgfsetshortenend{\board@pgf@shortenend}%
    \pgfpathmoveto{%
     \pgfpointadd
       {\pgfpointxy{0.5}{-0.5}}%
       {\pgfpoint{0pt}{-\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{-0.5}}%
      {\pgfpointadd
       {\pgfpoint{0pt}{0pt}}%
       {\pgfpoint{-\board@pgf@padding}{-\board@pgf@padding}}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{-0.5}{0.5}}%
      {\pgfpoint{-\board@pgf@padding}{\board@pgf@padding}}}%
    \pgfpathlineto{%
     \pgfpointadd
      {\pgfpointxy{0.5}{0.5}}%
      {\pgfpoint{0pt}{\board@pgf@padding}}}%
    \pgfusepath{stroke}}%

\endinput
%%
%% End of file `chessboard-pgf.sty'.
