% Copyright (c) 2026 Simon Rubinstein-Salzedo.
% Distributed under the LaTeX Project Public License, version 1.3c or later.
% Maintenance status: maintained. Current Maintainer: Simon Rubinstein-Salzedo.
% License: https://www.latex-project.org/lppl.txt
% See README.md for the list of files and attribution.
\documentclass[12pt]{amsart}
\usepackage{combgames-tikz}
\usepackage{verbatim}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{array}
\usepackage{fancyvrb}
\usepackage{bigstrut}
\ifPDFTeX\usepackage[T1]{fontenc}\fi
\usepackage[margin=1in]{geometry}
\usepackage{float,longtable,needspace}
\usepackage[hidelinks]{hyperref}
\setcounter{tocdepth}{2}


\newcommand\cn[1]{\texttt{\string#1}}
\newcommand\ds[1]{$#1$ & \cn{#1}}

\newenvironment{VExample}
{\VerbatimEnvironment\begin{VerbatimOut}{combgames-tikz-doc-example.out}}
	{\end{VerbatimOut}
	\par\noindent\begin{minipage}{\linewidth}
    \VerbatimInput{combgames-tikz-doc-example.out}
    \medskip\par
    \begin{center}$\displaystyle\input combgames-tikz-doc-example.out $\end{center}
    \end{minipage}\par\medskip}
	
\newenvironment{HExample}
{\VerbatimEnvironment\begin{VerbatimOut}{combgames-tikz-doc-example.out}}
	{\end{VerbatimOut}
	\begin{center}
		\begin{minipage}{.52\linewidth}
			\BVerbatimInput{combgames-tikz-doc-example.out}
		\end{minipage}
		\begin{minipage}{.44\linewidth}
			\centering$\displaystyle\input combgames-tikz-doc-example.out $
		\end{minipage}
\end{center}}

\title{Combinatorial Game Boards with TikZ}
\author{Simon Rubinstein-Salzedo}
\email{simon@eulercircle.com}
\date{Version 1.0 --- October 28, 2026}
\begin{document}
\raggedbottom
\begin{abstract}
The \textsf{combgames-tikz} package draws combinatorial game boards using TikZ. It replaces the PostScript boards of \textsf{combgames} and adds further games and color variants. Symbols and game notation come from the separate \textsf{combgames-symbols} package, which is loaded automatically.
\end{abstract}
\maketitle
{\footnotesize\tableofcontents}
\clearpage
\section{Installation and a first example}\label{sec:install}
Install \textsf{combgames-symbols} as well as this package.
For a local installation or an Overleaf project, place
\texttt{combgames-tikz.sty} beside your document and add the files
listed in the installation section of the \textsf{combgames-symbols} manual.
All examples compile with pdfLaTeX, XeLaTeX, or LuaLaTeX.
\begin{verbatim}
\documentclass{article}
\usepackage{combgames-tikz}
\begin{document}
A game: $\combgame{\{1|0\}}$.
\ToadsAndFrogs{TTT.FFF}
\end{document}
\end{verbatim}
The development versions used the name \texttt{cgt-board}.
Replace it by \texttt{combgames-tikz}; board commands retain their names.
For symbols and braces-and-slashes notation, see the
\textsf{combgames-symbols} manual.

\section{Game Boards}
There is also an extensible facility for typesetting grid-based games. To draw game boards, you must include the package \cn{combgames-tikz}. The following examples illustrate usage for all of the built-in games.

\subsection{Reading and sizing boards}
Most grid commands take an optional drawing unit followed by the rows:
\begin{verbatim}
\GameName[.5cm]{rows}
\end{verbatim}
The optional argument is a length, not a key such as \texttt{unit=.5cm}.
Rows run from top to bottom and cells from left to right;
separate rows with \verb|\\|. Spaces and completely empty rows are ignored, including a final row separator. To leave a gap, use the game's explicit empty or missing-cell token. A dot does \emph{not} have the same meaning in every game: the token descriptions below distinguish an empty square from a missing square. Unequal row lengths are allowed.

The length sets the coordinate unit. It is a square's side for square boards, a point-spacing unit for intersection boards, and a hexagon's width for \textsc{hex}. Text inside cells does not necessarily scale with this length. The board commands can be used in text or mathematics; they are vertically centered on the math axis. The package draws positions, but does not check the rules or calculate moves.

\subsection{Color versions}
The following commands have a corresponding \texttt{Color} version with the same arguments:
\begin{quote}\raggedright
\cn{\Push}, \cn{\Shove}, \cn{\AllSmallPush}, \cn{\AllSmallShove},
\cn{\TopplingDominoes}, \cn{\HackenbushString}, \cn{\Hex},
\cn{\ToadsAndFrogs}, \cn{\SkiJumps}, \cn{\HareAndHounds},
\cn{\NineMensMorris}, \cn{\Phutball} and \cn{\Minesweeper}.
\end{quote}
For example, use \cn{\ToadsAndFrogsColor}. Color normally identifies Left with blue and Right with red. In \textsc{phutball} it colors the move route instead; the stones remain black and white. \cn{\Minesweeper} is monochrome by default.
\cn{\MinesweeperColor} uses colored clues and a red flag. \textsc{Christmas lights} use their explicitly chosen colors.

The shared switch \cn{\gridgamecolortrue} also enables color in \textsc{push}/\textsc{shove}, \textsc{hackenbush strings}, \textsc{hex}, \textsc{toads and frogs}, \textsc{ski jumps}, \textsc{hare and hounds}, \textsc{nine men's morris}, \textsc{phutball}, and \textsc{minesweeper}; \allowbreak\cn{\gridgamecolorfalse} reverses it. Use a group to keep such a setting local. The \texttt{Color} wrappers do this automatically. \textsc{Toppling dominoes} uses a separate color token map, so use its \texttt{Color} command.

\subsection{Domineering}
\cn{\Domineering} defaults to \texttt{.35cm}. Use \texttt{o} for an unoccupied square, \texttt{x} for a shaded square, and \texttt{.} for a missing square. A horizontal domino is \texttt{<>}; a vertical domino has \texttt{n} in its upper cell and \texttt{v} immediately below. The upper-half token \verb|^| is also supported, but \texttt{n} avoids TeX's special treatment of consecutive carets and works reliably in arguments already read by another command. If using two carets, separate them with a space: \verb|^ ^|.

\begin{VExample}
\Domineering{ooo\\oo\\} = \combgame{
  \{\Domineering{noo\\vo}, \Domineering{ono\\ov}
  | \Domineering{<>o\\oo}, \Domineering{o<>\\oo},
    \Domineering{ooo\\<>}\}}
\end{VExample}

\subsection{Clobber and AntiClobber}
The original small and large \textsc{clobber} commands are retained: \cn{\clobber} defaults to \texttt{.3cm}, and \cn{\Clobber} to \texttt{.5cm}. The tokens \texttt{X}, \texttt{x}, \texttt{L}, and \texttt{l} draw dark pieces; \texttt{O}, \texttt{o}, \texttt{R}, and \texttt{r} draw light pieces. A dot is an empty square.
\begin{HExample}
\clobber{xxxo\\o.ox\\xoxo}
\end{HExample}
\begin{HExample}
\Clobber{xxxo\\o.ox\\xoxo}
\end{HExample}
\cn{\AntiClobber} uses the same tokens with inverted pieces, and defaults to \texttt{.3cm}. Its lowercase alias is \cn{\anticlobber}.
\begin{HExample}
\AntiClobber[.5cm]{XOXO\\OXOX\\XOXO}
\end{HExample}

\subsection{Dots and Boxes}
\cn{\DotsAndBoxes} defaults to \texttt{.35cm}. Dots and connecting edges occupy alternating positions in the input: \texttt{o} is a dot, \texttt{-} and \verb!|! are solid edges, \texttt{+} and \texttt{:} are dotted horizontal and vertical edges, and \texttt{.} leaves a position blank. \texttt{A} and \texttt{B} label boxes; \texttt{*} adds a loony symbol. The following preserves the original annotated example.
\begin{HExample}
\DotsAndBoxes{
 o+o.o.o-o-o\\
 |.|.|.|.*.|\\
 o.o.o.o*o*o\\
 |.|.|.|.|.|\\
 o-o.o.o*o*o\\
 |A|.|.|.|.|\\
 o-o.o.o*o*o}
\end{HExample}

\subsection{Strings and Coins}
\cn{\StringsAndCoins} defaults to \texttt{.35cm}. A coin is \texttt{o}, or \texttt{A}/\texttt{B} for a labeled coin. Use \texttt{-} and \verb!|! for strings, \texttt{+} and \texttt{:} for dotted strings, and \texttt{.} for a blank position. The annotated string tokens \texttt{*} (horizontal) and \texttt{!} (vertical) include a loony mark. Coins and strings occupy alternating positions.
\begin{HExample}
\StringsAndCoins[.5cm]{
 o-o-o\\
 |...|\\
 A+o-B}
\end{HExample}
\begin{HExample}
\StringsAndCoins[.5cm]{o*o\\!..\\o..}
\end{HExample}

\subsection{Chomp}
\cn{\Chomp} defaults to \texttt{.35cm}. Use \texttt{O} for a square, \texttt{P} (also \texttt{p} or \texttt{X}) for the poisoned square, and \texttt{.} for an absent square. Here the poison is at bottom left; the upper-right part of the chocolate bar has been eaten.
\begin{HExample}
\Chomp[.5cm]{OO....\\OOOO..\\POOOOO}
\end{HExample}

\subsection{Bridg-It}
\cn{\Bridgit} defaults to \texttt{.35cm}. The two sets of intersections are \texttt{x} (filled) and \texttt{o} (open); \texttt{-} and \verb!|! draw bridges. Dotted bridges are \texttt{+} and \texttt{:}; a dot leaves a position blank. The interleaved arrangement below includes a horizontal bridge for one player and a vertical bridge for the other.
\begin{HExample}
\Bridgit[.45cm]{
 .o.o.o.\\
 x-x.x|x\\
 .o.o.o.\\
 x.x.x.x\\
 .o.o.o.}
\end{HExample}

\subsection{Amazons}
\cn{\Amazons} defaults to \texttt{.35cm}. \texttt{L} and \texttt{R} are the two players' amazons (lowercase works too), \texttt{o} is an empty \emph{square}, and \texttt{x} is a blocked square containing an arrow. A dot omits a square entirely: it should not be used for the open cells of a full board.

This is the usual 10-by-10 starting arrangement, with four amazons for each player. The top row is rank 10; columns run from a to j. Here Left occupies a4, d1, g1, j4, and Right occupies a7, d10, g10, j7.
\begin{HExample}
\Amazons[.42cm]{
 oooRooRooo\\
 oooooooooo\\
 oooooooooo\\
 RooooooooR\\
 oooooooooo\\
 oooooooooo\\
 LooooooooL\\
 oooooooooo\\
 oooooooooo\\
 oooLooLooo}
\end{HExample}
For a realistic blocked position, move Left's a4 amazon to d4 and shoot an arrow back to a4. Every other piece remains in its starting square.
\begin{HExample}
\Amazons[.42cm]{
 oooRooRooo\\
 oooooooooo\\
 oooooooooo\\
 RooooooooR\\
 oooooooooo\\
 oooooooooo\\
 xooLoooooL\\
 oooooooooo\\
 oooooooooo\\
 oooLooLooo}
\end{HExample}

\subsection{Fox and Geese}
\cn{\FoxAndGeese} defaults to \texttt{.5cm}. Use \texttt{f} for the fox, \texttt{g} for a goose, \texttt{o} for an empty square, and \texttt{.} for a missing square. Uppercase \texttt{F}, \texttt{G}, and \texttt{O} are aliases.
\begin{HExample}
\FoxAndGeese{
ogogogog\\
.ooooooo\\
.ooooooo\\
.ooooooo\\
.ooooooo\\
.ooooooo\\
oooooooo\\
oooofooo}
\end{HExample}

\subsection{Push, Shove, and their all-small versions}
\cn{\Push}, \cn{\Shove}, \cn{\AllSmallPush}, and \cn{\AllSmallShove} all default to \texttt{.5cm}. They use \texttt{L}/\texttt{X} for Left, \texttt{R}/\texttt{O} for Right, and \texttt{G} for a neutral piece; lowercase aliases work. The all-small versions use smaller piece artwork. These examples show both the monochrome and color forms.
\begin{VExample}
\Push{LLRGLR}\quad\PushColor{LLRGLR}
\end{VExample}
\begin{VExample}
\Shove{LRRLLG}\quad\ShoveColor{LRRLLG}
\end{VExample}
\begin{VExample}
\AllSmallPush{LLRGLR}\quad\AllSmallPushColor{LLRGLR}
\end{VExample}
\begin{VExample}
\AllSmallShove{LRRLLG}\quad\AllSmallShoveColor{LRRLLG}
\end{VExample}
In \textsc{push}, \textsc{shove}, and \textsc{all  small shove}, a dot draws an empty track cell; in \textsc{all small push} it leaves a blank position. A literal \verb|#| leaves a blank position in all four maps.

\subsection{Toppling Dominoes}
\cn{\TopplingDominoes} and \cn{\TopplingDominoesColor} default to \texttt{.5cm}. Use \texttt{x}/\texttt{X}/\texttt{L}/\texttt{l} for Left's domino, \texttt{o}/\texttt{O}/\texttt{R}/\texttt{r} for Right's domino, \texttt{g}/\texttt{G} for a neutral domino, and \texttt{.} for an empty ground position.
\begin{VExample}
\TopplingDominoes{xxogox}\qquad
\TopplingDominoesColor{xxogox}
\end{VExample}

\subsection{Hackenbush strings}
\cn{\HackenbushString} defaults to \texttt{.5cm}. Each row is a horizontal string attached to ground at the left. Use \texttt{B} (or \texttt{L}) for blue, \texttt{R} for red, and \texttt{G} for green; lowercase aliases work. A dot leaves a gap. In monochrome, blue is solid, red is double, and green is gray. The spelling \cn{\Hackenbushstring} is also accepted, including its \texttt{Color} form.
\begin{VExample}
\HackenbushString{BBR\\RBG}\qquad
\HackenbushStringColor{BBR\\RBG}
\end{VExample}

\subsection{General Hackenbush diagrams}

For more complicated \textsc{hackenbush} positions and positions with cycles, use TikZ
directly. The package supplies two styles:
\texttt{hackenline} draws edges with a default thickness of
\texttt{3pt}, and \texttt{hackennode} draws white-filled,
outlined circular vertices. Draw the edges first and the
vertices afterward.

The following position has a blue stalk with red and blue
branches. The gray horizontal line represents the ground.

\begin{VExample}
\begin{tikzpicture}
  \coordinate (root) at (0,0);
  \coordinate (fork) at (0,1);
  \coordinate (left) at (-.8,2);
  \coordinate (right) at (.8,2);

  \draw[gray,line width=2pt] (-1.2,0)--(1.2,0);
  \draw[hackenline,blue] (root)--(fork);
  \draw[hackenline,red] (fork)--(left);
  \draw[hackenline,blue] (fork)--(right);

  \node[hackennode] at (fork) {};
  \node[hackennode] at (left) {};
  \node[hackennode] at (right) {};
\end{tikzpicture}
\end{VExample}

Cycles can be drawn in the same way. Here a green stalk
supports a triangle with blue, red, and green edges.

\begin{VExample}
\begin{tikzpicture}
  \coordinate (root) at (0,0);
  \coordinate (base) at (0,.8);
  \coordinate (left) at (-.8,1.8);
  \coordinate (right) at (.8,1.8);

  \draw[gray,line width=2pt] (-1.2,0)--(1.2,0);
  \draw[hackenline,green!70!black] (root)--(base);
  \draw[hackenline,blue] (base)--(left);
  \draw[hackenline,red] (base)--(right);
  \draw[hackenline,green!70!black] (left)--(right);

  \node[hackennode] at (base) {};
  \node[hackennode] at (left) {};
  \node[hackennode] at (right) {};
\end{tikzpicture}
\end{VExample}

These diagrams use explicit TikZ colors.
The shared board-color switch does not affect them. Coordinates, ground lines, and edge
connections are supplied by the author.

To change the appearance locally, add options to the
\texttt{tikzpicture}, for example:
\begin{verbatim}
\begin{tikzpicture}[
  hackenline/.append style={line width=1.5pt},
  hackennode/.append style={minimum size=3pt}]
  ...
\end{tikzpicture}
\end{verbatim}

\subsection{Hex and boundary components}
\cn{\Hex} and \cn{\HexColor} have syntax \begin{verbatim}\Hex[unit][options]{rows}\end{verbatim} 
with default unit \texttt{.5cm}. Use \texttt{o} (or \texttt{*}) for an empty hexagon, \texttt{X} for a Left stone with its cell outline, and \texttt{O} for a Right stone with its cell outline. \texttt{L} and \texttt{R} draw just the stones. In the color version these are blue and red. Aliases are \texttt{x} for \texttt{X}, and \texttt{l}/\texttt{r} for \texttt{L}/\texttt{R}. A dot omits a cell. Lowercase \texttt{o} always means an empty hexagon, not a Right stone.
\begin{HExample}
\HexColor[.55cm][boundary=standard]{
 ooOoo\\
 oXXoo\\
 ooOXo\\
 oOooo\\
 ooooo}
\end{HExample}
\texttt{boundary=standard} colors the top and bottom boundary red and the left and right boundary blue. \texttt{boundary=swapped} reverses them; \texttt{boundary=none} is the default. The shortcut requires equally long rows with no omitted cells.

For fragments, specify individual edges instead. An entry has the form \texttt{row/}\allowbreak\texttt{column/}\allowbreak\texttt{direction/}\allowbreak\texttt{color}, with row and column counted from 1 at the \emph{top left of the input}. Directions are \texttt{NE,E,SE,SW,W,NW}; colors are \texttt{blue} and \texttt{red}. Edges must refer to existing cells. This marks only the selected boundary segments, rather than treating the fragment as an entire board.
\begin{HExample}
\HexColor[.65cm][edges={
 1/2/NW/red,1/2/NE/red,
 2/1/W/blue,2/1/SW/blue}]{
 .o.\\
 oXo\\
 .O.}
\end{HExample}
Explicit edges are drawn after the full-board shortcut, so they can also override selected edges. Boundary colors are explicit annotations and remain colored even with \cn{\Hex}.

\subsection{Maze and Maize}
\cn{\Maze} and \cn{\Maize} default to \texttt{.3cm}. Cells are
lightly shaded gray, with white seams separating neighboring cells
where there is no wall. Actual walls are drawn in black.

Both commands use the same wall encoding. Around a cell's diamond,
assign weights 1 to left--top, 2 to top--right, 4 to right--bottom,
and 8 to bottom--left. Add the selected weights and write the result
as one hexadecimal digit \texttt{0--9,a--f}. Uppercase \texttt{A--P}
selects the same sixteen wall combinations \emph{with a center
marker}, in order. \textsc{Maze}'s marker is a circled star;
\textsc{Maize}'s is a circled dot.

For example, \texttt{5} selects the walls of weights 1 and 4,
and \texttt{F} selects those same walls with a center marker.
A shared wall may be specified by either neighboring cell;
it need not be specified by both.

The diamond cells occupy alternating positions, like one color
of a checkerboard. Use \texttt{.} for intervening positions and
locations outside the board. Use \texttt{0} or \texttt{o} for an
actual shaded cell with no walls or marker. Thus, dots and zeros
are no longer interchangeable.

\begin{VExample}
\Maze{..D\\.1.e\\J.E\\.0..\\d.e}\qquad
\Maize{..D\\.1.e\\J.E\\.0..\\d.e}
\end{VExample}

The tokens \texttt{*} and \texttt{x} give a shaded cell with a
center marker and no walls. The tokens \texttt{/} and \verb!|!
select the southwest/northeast and northwest/southeast pairs
of walls, respectively; they are equivalent to \texttt{a} and
\texttt{5}.

\par\noindent\begin{minipage}{\linewidth}
The following atlas separates the sixteen wall patterns. Each pair of token names
selects the plain walls or the corresponding marked cell. The final column in each group
shows the marked Maize version.
\begin{center}\small
\begin{tabular}{c c c c @ {\qquad} c c c c}
Tokens & Walls & Maze & Maize & Tokens & Walls & Maze & Maize\\[3pt]
\texttt{0/A} & \TokenBox[.27cm]{MAZE}{0} & \TokenBox[.27cm]{MAZE}{A} & \TokenBox[.27cm]{MAIZ}{A} & \texttt{8/I} & \TokenBox[.27cm]{MAZE}{8} & \TokenBox[.27cm]{MAZE}{I} & \TokenBox[.27cm]{MAIZ}{I}\\[3pt]
\texttt{1/B} & \TokenBox[.27cm]{MAZE}{1} & \TokenBox[.27cm]{MAZE}{B} & \TokenBox[.27cm]{MAIZ}{B} & \texttt{9/J} & \TokenBox[.27cm]{MAZE}{9} & \TokenBox[.27cm]{MAZE}{J} & \TokenBox[.27cm]{MAIZ}{J}\\[3pt]
\texttt{2/C} & \TokenBox[.27cm]{MAZE}{2} & \TokenBox[.27cm]{MAZE}{C} & \TokenBox[.27cm]{MAIZ}{C} & \texttt{a/K} & \TokenBox[.27cm]{MAZE}{a} & \TokenBox[.27cm]{MAZE}{K} & \TokenBox[.27cm]{MAIZ}{K}\\[3pt]
\texttt{3/D} & \TokenBox[.27cm]{MAZE}{3} & \TokenBox[.27cm]{MAZE}{D} & \TokenBox[.27cm]{MAIZ}{D} & \texttt{b/L} & \TokenBox[.27cm]{MAZE}{b} & \TokenBox[.27cm]{MAZE}{L} & \TokenBox[.27cm]{MAIZ}{L}\\[3pt]
\texttt{4/E} & \TokenBox[.27cm]{MAZE}{4} & \TokenBox[.27cm]{MAZE}{E} & \TokenBox[.27cm]{MAIZ}{E} & \texttt{c/M} & \TokenBox[.27cm]{MAZE}{c} & \TokenBox[.27cm]{MAZE}{M} & \TokenBox[.27cm]{MAIZ}{M}\\[3pt]
\texttt{5/F} & \TokenBox[.27cm]{MAZE}{5} & \TokenBox[.27cm]{MAZE}{F} & \TokenBox[.27cm]{MAIZ}{F} & \texttt{d/N} & \TokenBox[.27cm]{MAZE}{d} & \TokenBox[.27cm]{MAZE}{N} & \TokenBox[.27cm]{MAIZ}{N}\\[3pt]
\texttt{6/G} & \TokenBox[.27cm]{MAZE}{6} & \TokenBox[.27cm]{MAZE}{G} & \TokenBox[.27cm]{MAIZ}{G} & \texttt{e/O} & \TokenBox[.27cm]{MAZE}{e} & \TokenBox[.27cm]{MAZE}{O} & \TokenBox[.27cm]{MAIZ}{O}\\[3pt]
\texttt{7/H} & \TokenBox[.27cm]{MAZE}{7} & \TokenBox[.27cm]{MAZE}{H} & \TokenBox[.27cm]{MAIZ}{H} & \texttt{f/P} & \TokenBox[.27cm]{MAZE}{f} & \TokenBox[.27cm]{MAZE}{P} & \TokenBox[.27cm]{MAIZ}{P}\\[3pt]
\end{tabular}\end{center}
\end{minipage}\par

\subsection{Christmas Lights' Fixture}
\cn{\Xmas} takes an optional drawing unit (default
\texttt{.35cm}) followed by a string of fixture characters.
It does not use row separators. Letter case is ignored. The bulbs are \texttt{C} (cyan), \texttt{G} (green), \texttt{O} (orange), \texttt{R} (red), \texttt{Y} (yellow), \texttt{W} (unfilled), and \texttt{B} (broken). \texttt{M} draws a short gray rail with bars at both ends;
\texttt{N} has a bar only at the right end.
\texttt{P} draws a plug, normally placed at the beginning
of the string. Unrecognized characters are skipped.
\begin{VExample}
\Xmas[.1cm]{POYCBWBGOBWRWYBWWO}
\end{VExample}
\begin{VExample}
\Xmas[.1cm]{PCOY}\qquad\Xmas[.1cm]{OMBNR}
\end{VExample}
Individual commands \cn{\XmasB}, \cn{\XmasC}, \cn{\XmasG}, \cn{\XmasM}, \cn{\XmasN}, \cn{\XmasO}, \cn{\XmasP}, \cn{\XmasR}, \cn{\XmasW}, and \cn{\XmasY} are available. \verb|\UseXmas{R}| invokes the corresponding uppercase command. The individual commands use the default unit.
For a single fixture at another size, use either
\verb|\Xmas[.25cm]{R}| or the single-token interface:
\begin{VExample}
\TokenBox[.25cm]{XMAS}{R}
\end{VExample}

\subsection{Minesweeper}
\cn{\Minesweeper} defaults to \texttt{.5cm}. A dot draws an unlabelled square; \texttt{0--8} draw clues; \texttt{f} is a flag. Tokens \texttt{a,b,c} print variables, while \texttt{A,B,C} print their barred forms. 
\begin{HExample}
\Minesweeper{
.....\\
.3110\\
.2f10\\
.1110\\
.aA00}
\end{HExample}
\begin{HExample}
\MinesweeperColor{
......\\
..ff..\\
112211\\
000000}
\end{HExample}

\subsection{Toads and Frogs}
\cn{\ToadsAndFrogs} defaults to \texttt{.6cm}. \texttt{T} is a dark toad facing right, and \texttt{F} a light frog facing left. \texttt{L} and \texttt{R} are aliases; all four also accept lowercase. A dot or \texttt{o} is an empty square. Color versions use blue toads and red frogs.
\begin{VExample}
\ToadsAndFrogs{TTT.FFF}\qquad
\ToadsAndFrogsColor{TTT.FFF}
\end{VExample}

\subsection{Ski Jumps}
\cn{\SkiJumps} defaults to \texttt{.6cm}. \texttt{L} and \texttt{R} are jumpers, while \texttt{l} and \texttt{r} are slippers. Uppercase and lowercase therefore have different meanings here. Left's figures face left; Right's face right. A dot or \texttt{o} is an empty square. This diagram illustrates all four piece states.
\begin{VExample}
\SkiJumps{L..R\\.lr.\\R..L}\qquad
\SkiJumpsColor{L..R\\.lr.\\R..L}
\end{VExample}

\section{Boards with named points and coordinates}
These commands draw their own board geometry. They take \emph{two} mandatory arguments, even for an empty board. Supply \texttt{\{\}} for an empty list. The general form is \verb|\Game[unit][options]{first list}{second list}|. To supply options, also supply the first optional argument. Every command in this section has a \texttt{Color} version with identical syntax.

\subsection{Hare and Hounds}
\cn{\HareAndHounds} defaults to \texttt{1cm}. The first list gives hound positions; the second gives the hare position. Positions are named \texttt{a2}, \texttt{b1--b3}, \texttt{c1--c3}, \texttt{d1--d3}, and \texttt{e2}; numbers increase upward. Use \texttt{labels} (or \texttt{labels=true}) to print the point names. The initial position from the manuscript is:
\begin{VExample}
\HareAndHounds[1cm][labels]{a2,b1,b3}{e2}
\qquad
\HareAndHoundsColor[1cm]{a2,b1,b3}{e2}
\end{VExample}
The board connections are built in. For a blank reference board, use:
\begin{verbatim}
\HareAndHounds[1cm][labels]{}{}
\end{verbatim}
The hound and rabbit figurines are TikZ paths, so no external image files are needed. Unknown point names and duplicate occupied points produce errors.

\subsection{Nine Men's Morris}
\cn{\NineMensMorris} defaults to \texttt{.65cm}. The first list gives Left's pieces, the second Right's. Names follow a seven-by-seven coordinate frame: \texttt{a1} is bottom left and \texttt{g7} top right. Only the board's 24 marked points are valid; for example, \texttt{d4} is not a point. The \texttt{labels} option displays the names.
\begin{HExample}
\NineMensMorris[.65cm][labels]{}{}
\end{HExample}
This position reproduces the manuscript's shaded blue and red balls.
\begin{HExample}
\NineMensMorrisColor[.75cm]
 {b2,f2,f6,f4,b4,c4}
 {d1,d2,e3,e4,e5}
\end{HExample}
Without \texttt{Color}, the balls are shaded black and white. The command draws the board and pieces; it does not track reserves, turns, mills, or captures.

\subsection{Phutball}
\cn{\Phutball} defaults to \texttt{.35cm}. The first list gives black stones; the second gives the white ball (one coordinate, or an empty argument). Coordinates use \texttt{x/y}, with \texttt{1/1} at bottom left. The defaults are \texttt{columns=15,rows=19}. The example below is the manuscript's position, including its three-jump route.
\begin{HExample}
\PhutballColor[.3cm][
 move={11/6,8/9,8/11,10/11}]
 {11/3,11/5,10/7,9/8,9/9,
  8/10,9/11,9/13,9/15}
 {11/6}
\end{HExample}
The move list starts at the ball and then lists each landing. A thin dashed route is drawn behind the stones so the stones remain intact. Landings are numbered by default; use \texttt{numbered=false} to suppress the numbers. \cn{\PhutballColor} uses a red route, while \cn{\Phutball} uses black. The key \texttt{move color=blue}, for example, overrides either default.

Use \texttt{labels} to display grid coordinates. A smaller board is useful for a local position, and move endpoints may lie beyond the grid to show a goal:
\begin{HExample}
\Phutball[.5cm][columns=5,rows=5,
 labels,move={3/3,3/6}]
 {3/4,3/5}{3/3}
\end{HExample}
Stone coordinates must be on the board, and occupied points cannot be duplicated. Move routes are annotations: the command does not validate jumps or remove the stones crossed. Supply the resulting position separately when illustrating a before-and-after move. Avoid repeated landing coordinates in one numbered route, since their labels would overlap.

\section{Defining and customizing tokens}
The extensible grid facility now uses TikZ. A token definition has the form
\begin{verbatim}
\gridtoken{map}{character}{drawing code}
\end{verbatim}
The drawing code runs in a local scope at that token's position. For a square board, draw inside the unit square from $(0,0)$ to $(1,1)$. Then call \verb|\GridGame[unit]{map}{rows}|, or define a wrapper. Here is a complete example of a new token map:
\begin{VExample}
\gridtoken{DEMO}{o}{\draw (0,0) rectangle (1,1);}
\gridtoken{DEMO}{L}{
 \draw (0,0) rectangle (1,1);
 \fill[blue] (.5,.5) circle[radius=.3];}
\gridtoken{DEMO}{.}{}
\GridGame[.5cm]{DEMO}{LoL\\ooo}
\end{VExample}
For a reusable command, put the definitions in the preamble and add:
\begin{verbatim}
\NewDocumentCommand{\MyBoard}{O{.5cm} m}{
\GridGame[#1]{DEMO}{#2}}
\end{verbatim}
Then \verb|\MyBoard{LoL\\ooo}| draws the same board. Redefining a token replaces its existing drawing, and definitions can be localized with a TeX group. Use one character per token. Unknown tokens in \cn{\GridGame} generate a warning and leave that position blank.

Both \cn{\GridGame} and \cn{\TokenBox} default to a \texttt{.35cm} unit. \cn{\TokenBox} draws a single registered token without the row parser:
\begin{HExample}
\TokenBox[.6cm]{TAF}{T}
\end{HExample}
The built-in map names are shown here for customization.
\begin{center}\small
\begin{tabular}{ll@{\qquad}ll}
Domineering & \texttt{DomTok}
  & Clobber & \texttt{CLOB}\\
AntiClobber & \texttt{ACLOB}
  & Dots and Boxes & \texttt{DAB}\\
Strings and Coins & \texttt{SNC}
  & Chomp & \texttt{CHM}\\
Bridg-It & \texttt{BRG}
  & Amazons & \texttt{AMZ}\\
Fox and Geese & \texttt{FNG}
  & Push / Shove & \texttt{PUSH / SHOV}\\
All-small Push / Shove & \texttt{ASP / ASHV}
  & Toppling Dominoes & \texttt{TDOM / TDOMC}\\
Hackenbush strings & \texttt{HACK}
  & Hex & \texttt{HEX}\\
Maze & \texttt{MAZE}
  & Maize & \texttt{MAIZ}\\
Toads and Frogs & \texttt{TAF}
  & Ski Jumps & \texttt{SKI}\\
Minesweeper & \texttt{MINE}
  & Christmas fixtures & \texttt{XMAS}
\end{tabular}
\end{center}

Color variants share the corresponding token map, except for
\textsc{toppling dominoes}, which uses \texttt{TDOM} for monochrome
and \texttt{TDOMC} for color. Both \textsc{minesweeper} variants use \texttt{MINE}.

\cn{\HareAndHounds}, \cn{\NineMensMorris}, and \cn{\Phutball}
use named board positions rather than token maps.
Use their dedicated commands, including their \texttt{Color}
variants.

\textsc{Christmas lights' fixtures} artwork spans more than a unit square.
Use \cn{\Xmas} for complete strings or \cn{\TokenBox}
for individual fixtures, rather than placing them in
adjacent \cn{\GridGame} cells.

\section{Compatibility with combgames}
The original \href{https://github.com/aaron-siegel/combgames/blob/master/doc/latex/combgames/combgames.tex}{\textsf{combgames} manual}, by Aaron N.\ Siegel and David Wolfe, provides the model for this manual's source-and-result examples. This rewrite retains the symbol and braces-and-slashes interfaces and supplies TikZ board renderers, including additional games and color variants.

It is not a drop-in implementation of every original facility. In particular, \cn{\cgtree}, \texttt{thermoplot}, \cn{\thermograph}, \cn{\trajectory}, and the old \cn{\newgridgame} interface are not implemented here. Nor are PSTricks key lists such as \texttt{unit=.5cm} accepted in place of a board length. Use \cn{\gridtoken} and \cn{\GridGame} for new boards. Loading \textsf{combgames} together with these packages may cause conflicting command definitions.

The \texttt{treenode} style provides unoutlined nodes
for manually drawn game trees.
\begin{VExample}
\begin{tikzpicture}
  \node[treenode] (g) at (0,1) {$G$};
  \node[treenode] (l) at (-1,0) {$G^L$};
  \node[treenode] (r) at (1,0) {$G^R$};
  \draw (g)--(l) (g)--(r);
\end{tikzpicture}
\end{VExample}


\clearpage
\section{Troubleshooting}
\begin{description}
\item[Adjacent vertical domineering pieces fail]
Use \texttt{n} for the top half. TeX can interpret consecutive carets before the board parser sees them.
\item[Literal bars fail in a macro or another argument]
Inside \cn{\combgame}, use the explicit slash commands described in the \textsf{combgames-symbols} manual.
\item[Squares disappear]
Check the board's token vocabulary. In \textsc{amazons}, for example, \texttt{o} draws an empty square but \texttt{.} omits it. Blank input rows do not reserve vertical space.
\item[An option or position is rejected]
Check the command's argument order and coordinate convention. \textsc{Hex} edges count rows downward from the top; \textsc{phutball} coordinates count upward from the bottom. Named-point boards accept only the names shown by \texttt{labels}.
\end{description}
\end{document}
