\documentclass{article}

\usepackage{wargame}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{shadows.blur}
\title{A test of \textsf{wargame}}
\author{}
\date{}
\input{testmap}
\input{testchits}
\begin{document}
\maketitle
%\chitdbglvl=6
%\wargamedbglvl=5
\natoappdbglvl=1

\section{A board}

\begin{tikzpicture}
  \begin{scope}[every hex/.style={/hex/label=auto},
    hex/board frame/.style={fill=Tan}]
    \boardframe[0.5](c=0,r=0)(c=3,r=3)
    \boardpath(c=0,r=0)(c=3,r=3)
    \draw[fill=white,very thick] \hexboardpath;
    \boardclip(c=0,r=0)(c=3,r=3){fill=white}
    \testmap{}
  \end{scope}
\end{tikzpicture}

\section{Some chits}
      
\begin{tikzpicture}[every chit node/.style={blur shadow={shadow blur steps=5}}]
  \fill[red!50] (1,-1) rectangle (3,1);
  \firstchit(0,0)%
  %\secondchit(2,0)%
  \fourthchit(2,0)%
  \thirdchit(4,0)%
  \turnchit(6,0)%
%   \chitdbglvl=4
  \chit[my chit](0,-2)
  \chit[my chit,color=white,fill=red,right={chit/identifier=1}](2,-2)
%   \chitdbglvl=0
  \chit[fort](4,-2)
  \node[chit={my chit},/chit/left={[font=\noexpand\rmfamily]chit/identifier={foo}},draw] at (6,-2) {};
%   
\end{tikzpicture}
 
\section{Chits on a board}
\begin{tikzpicture}[every chit/.style={chit drop}]
  \chitdbglvl=5
  \begin{scope}[every hex/.style={/hex/label=auto},transform shape]
    \boardframe[0.5](c=0,r=0)(c=3,r=3)
    \boardclip(c=0,r=0)(c=3,r=3){fill=white}
    \testmap{}
    \firstchit[no chit drop](hex cs:c=2,r=2)
    %\secondchit(hex cs:c=3,r=0)
    \thirdchit(hex cs:c=0,r=3)
 
    \stackchits(hex cs:c=0,r=1)(.3,.3){
      \noexpand\firstchit,
      \noexpand\secondchit%/\noexpand\eliminatechit
    }
    
    \begin{scope}[m/.style={hex/long move=green}]
      \path[m] (hex cs:c=3,r=0) -- (hex cs:c=3,r=1)--(hex cs:c=3,r=2);
    \end{scope}
    \begin{scope}[a/.style={hex/attack}]
      \path[a] (hex cs:c=1,r=0) -- (hex cs:c=1,r=1);
    \end{scope}
  \end{scope}
  \turnchit(7,3)
\end{tikzpicture}

\section{NATO App6(C) symbols}

\begin{tikzpicture}
  \natoapp[faction=friendly,frame={faction},command=land,main=infantry](0,0)
  %
  \natoapp[faction=friendly,
  frame={faction},
  main={infantry,engineer},
  lower=mountain,
  color=red](2,0)
  %
  \natoapp[faction=unknown,
  command=sea surface,
  main={diving=military},color=blue](4,0)
  %
  \natoapp[faction=unknown,
  command=space,
  main={[fill]satellite},
  color=green](6,0)
  %
  \natoapp[
  faction=none,
  command=base,
  echelon=army,
  main={text=M},
  top={text=T},
  bottom={text=B},
  left={text=L},
  right={text=R},
  below={text=V}](8,0)
  %
  \natoapp[faction=hostile,
  frame={faction},
  command=land,
  echelon=company,
  main=rifle](10,0)
  \begin{scope}[scale=.5]
    \natoapp[faction=hostile,
    command=land,
    echelon=platoon,
    main={rifle}](24,0)
  \end{scope}

  \natoapp[faction=friendly,frame={faction},
  command=land,main=infantry,decoy](0,-2)  

  \natoapp[faction=friendly,frame={faction},
  command=land,main=infantry,decoy,scale line widths,line
  width=1pt](2,-2)

  \begin{scope}[scale=.5]
    \natoapp[faction=friendly,frame={faction},
    command=land,main=infantry,decoy,scale line widths,line
    width=1pt](8,-4)
  \end{scope}
\end{tikzpicture}

\section{Rotations}

%\chitdbglvl=5
%\natoappdbglvl=11
\begin{tikzpicture}
  \begin{scope}[rotate=45,transform shape]
    \message{^^J======= Chit rotated 45}
    \chit[symbol={[faction=friendly,command=land,echelon=division,
      main=anti tank anti armour]}](0,0)

    \message{^^J======= NATO App6(D) rotated 45}
    \natoapp[faction=friendly,command=land,echelon=division,
    main=anti tank anti armour](0,2)

    \message{^^J======= NATO App6(D) rotated 45}
    \natoapp[faction=friendly,command=land,echelon=division,
    main=air defence](0,4)
  \end{scope}

  \begin{scope}[shift={(4,0)}]
    \message{^^J==== Normal chit}
    \chit[symbol={[faction=friendly,command=land,echelon=division,
      main=anti tank anti armour]}](0,0)
    
    \message{^^J==== Normal NATO App6(D)}
    \natoapp[faction=friendly,command=land,echelon=division,
    main=anti tank anti armour](0,2)
    
    \message{^^J==== Normal NATO App6(D)}
    \natoapp[faction=friendly,command=land,echelon=division,
    main=air defence](0,4)
    
  \end{scope}
\end{tikzpicture}

\begin{tikzpicture}
  \begin{scope}[]
    \node[draw,chit={symbol={faction=friendly,command=land,main=infantry}}]
    (A) {};
    \foreach \a in {north,west,south,east}{%
      \draw[fill=red] (A.\a) circle(.1);}
    \draw[thick,green] circle(.2);
  \end{scope}
\end{tikzpicture}
\end{document}
