%%  This file is really -*-LaTeX-*-
%%          Project:  Courses/CPSC101/Project/2022/problem/
%%             File:  rules-of-backgammon.tex
%%       Created by:  David Casperson
%%          Created:  Sat Jan 15 13:43:24 2022
%%         Modified:  Sat Jan 15 13:54:38 2022
%%
%%      Description:  Eventually a description of backgammon


\section{The Rules of Backgammon}\label{sec:rules-backgammon}

These rules are loosely based on those found at \\
\url{https://www.mastersofgames.com/rules/backgammon-rules.htm}
They have been rewritten slightly with the goal of making OOD class
extraction easier.


\begin{figure}
  \begin{center}
  \includegraphics[scale=0.5]{empty-board.pdf}
  \end{center}
  \vspace*{-3ex}
  \caption{An empty board}
  \label{fig:backgammon-empty}
\end{figure}
\begin{figure}
  \begin{center}
  \includegraphics[scale=0.5]{initial-board.pdf}
  \end{center}
  \vspace*{-3ex}
  \caption{The initial configuration from black's perspective}
  \label{fig:backgammon-initial}
\end{figure}
\begin{multicols}{2}
\setlength{\parindent}{0.7em}
\subsection{Equipment and Terminology}
Backgammon is played on a specially designed board (see
Figure~\ref{fig:backgammon-empty})
consisting of  four \textit{tables}, each containing six
thing triangles (called \textbf{points}) of alternating colours.
Traditionally, the numbering and initial board configuration is chosen
so that the \textsf{1} and \textsf{24} points are closest the good
light.  


There are fifteen white pieces and fifteen black pieces (circular
disks), two \textbf{dice}, and a \textbf{doubling cube}.
Backgammon is a two player game, and we will refer to the players as
black and white.


The doubling cube is an essential part of serious backgamman, but may be
ignored for this project.  The doubling cube is described further in
Section~\ref{sec:doubling-cube}. 

Figure~\ref{fig:backgammon-initial} shows the \textbf{initial
  game configuration} from black's perspective.
The two tables with points numbered 24--19 and 18--13 are black's
\textbf{outer tables} or \textbf{outer boards}.
Conversely, the two tables with points numbered 12--7 and 6--1 are black's
\textbf{inner tables} or \textbf{inner boards}.
In particular the lowest numbered table is black's \textbf{home board}.

During a game, all of black's pieces are either 
\begin{compactitem}
\item
  on one of the the 24 numbered points, 
\item
  on the \textbf{bar} --- the vertical strip that divides the board in
  half, or 
\item
  have been successfully ``born off'' and are no longer in the game.
\end{compactitem}
Typically pieces that are born off are placed in the storage
compartments where the pieces lie when the game board is not in use.


\subsection{Objective}
Black's objective is to move her pieces around the board lower numbered
points and eventually to her home board and then off the board before
white.

White's situation mirrors black, and white's pieces move in the opposite
direction.

In the setup shown in Figure~\ref{fig:backgammon-initial} black's
pieces move clockwise and white's pieces move count-clockwise.
It is also possible to set up the board mirror-reflected around the
bar.  Traditionally, the players' home boards are closest to the better
light.



\subsection{Starting}

\noindent
To start the game, each player places her pieces as shown in
Figure~\ref{fig:backgammon-initial}, that is 
\begin{compactitem}
\item two pieces on her \textsf{24} point,
\item five pieces on her \textsf{13} point,
\item three pieces on her \textsf{8} point, and
\item five pieces on her \textsf{6} point.
\end{compactitem}

Each player then rolls one die, and the player with the higher die value
then plays first using the values on the dice.  If the two players roll
the same value, they roll again.  Note that this means that the first
player never starts with doubles.


\subsection{Basic Play}

During the game each of the 24 numbered points can either be empty, have
white pieces on, or have black pieces on it, but there are never both
white and black pieces on the same point.

There is no limit (other than
15) to the total number of pieces that can be on one point.  Usually a
point is about 5 pieces long; if there are more pieces than that on a
point, they are just stacked up.

A point with two or more pieces on it is \textit{safe}, and the opponent
cannot land a piece there.  A single piece on a point is called a
\textbf{blot}, and the opponent can land a piece on the blot which
removes the blot from the numbered board and places it on the bar.

Captured pieces re-enter from the bar as if they were on
point~\textsf{25}.
If black had a piece on the bar, and rolled a 4, she could move it to
the \textsf{21} point (assuming that white had less than two stones
there).

Players must re-enter their captured stones before they can make any
other moves.

\subsubsection{Playing Dice rolls}
A normal (non-double) dice roll represents two separate plays that can
be made in either order; so, for
instance, if white were to roll \textit{3--1} a the beginning of the
game, she could move one piece from her \textsf{8} point to her
\textsf{5} point, and another piece from her \textsf{6} point to her
\textsf{5} point, thereby making her \textsf{5} point safe.

Alternatively, she could use the \textit{3} to move a piece from her
\textsf{13} point to her \textsf{10} point, and then move that piece
again to her \textsf{9} point.  (Here, the order matters, as she cannot
use the \textit{1} to move from the \textsf{13} point because black has
more than one piece there.)

\textbf{Doubles} represent four individual plays of the value on one of the
dice.

A player \textbf{must} play all of her roll if possible (even if this
means leaving blots).  In the case where a player can play either roll,
but not both, she must make a play with the higher die value.

\subsection{Bearing Off}

Remvoing pieces from the board is called \textbf{bearing off}.  A player
may begin (or resume) bearing off whenever all of her pieces are in her
home board.

In bearing off, the target is ``\textsf{0}''.  That is, a \textit{3}
allows you to bear off a piece on your \textsf{3} point, and so on.
(f a player rolls a number higher than the highest point on which the
player has a piece, the player is allowed to bear off from that highest
point instead.

Should a player have a piece captured while bearing off, they need to
stop bearing off until all of their remaining pieces are back in their
inner board.

\subsection{Winning}


A player who removes all of her pieces before her opponent does wins.
A
plerer who removes all of her pieces before her opponent removes a
single piece wins a \textbf{gammon} which is worth twice as much.
A
plerer who removes all of her pieces before her opponent removes a
single piece and while her opponent still has a piece on the bar, or in
her home board wins a \textbf{backgammon} which is worth three times as much.

\subsection{The Doubling Cube}\label{sec:doubling-cube}
\begin{itemize}
\item optional
\item doubling and redoubling
\item refusing a double
\item accepting a double
\end{itemize}

Playing with a \textbf{doubloing cube} is optional, but is a standard
part of the game when playing a multi-game match or when playing for
stakes.

The doubling cube is like a die, but has the number 2, 4, 8, 16, 32, and
64 on its faces.  At the beginning of the game the doubling cube is set
half way between the players with the 64 face upmost (the 64 represents
1 in this circumestance).

Whenever the doubling cube is in the middle or on their side of the
table, a player may double before rolling the dice.

To double, a player takes the doubling cube totates it so that the next
highest number is showing, places it on the opponent's side of the board
and says ``I double''.

The opponent then has a choice.  The opponenet can say ``I refuse'',
conceding the \textit{current} (pre-double) stakes, or the opponenet can
say ``I accpt'', in which place the game continues for the new doubled
stakes.

When a player refuses a double, they lose a simple game at the current
stakes.  However, if a double is accepted and a player then wins by a
gammon or a backgammon, the multiplying effect of both the doubling cube
and the gammon or backgammon both come into effect.  For example if a
player loses a backgammon after the game has been double three times,
they lose \(24\) times the original stakes.

\end{multicols}

\newpage
\section{Glossary}
\newcommand\markLetter[1]{\item [\llap{\large\sffamily\color{red!50!black} #1\hspace{2em}}]%
     \mbox{}\par\vspace*{-4ex}}

\begin{description}
  \markLetter{B}
\item [Backgammon] A win where a player removes all of their pieces
  bofore the opponent removes a single piece \textit{and} the opponent
  still has pieces on the bar or in the winner's home board.  A
  backgammon counts three times as much as a normal when.
\item [bar]
  The vertical section down the middle of the board.  Pieces that are
  captured are placed on the bar, on the side closer to their opponent.
\item [blot]
  A single piece on a point.  A blot is vulnerable to capture.

\markLetter{G}
\item [Gammon]
  A win where a player removes all of their pieces bofore the opponent
  removes a single piece.  A gammon counts twice as much as a normal
  when. 
\end{description}



%%- Local Variables: -%%
%%- tex-main-file: "./2022-cpsc101-project-spec.tex" -%%
%%- End: -%%
