Skip to main content\( \newcommand{\identity}{\mathrm{id}}
\newcommand{\notdivide}{{\not{\mid}}}
\newcommand{\notsubset}{\not\subset}
\newcommand{\lcm}{\operatorname{lcm}}
\newcommand{\gf}{\operatorname{GF}}
\newcommand{\inn}{\operatorname{Inn}}
\newcommand{\aut}{\operatorname{Aut}}
\newcommand{\Hom}{\operatorname{Hom}}
\newcommand{\cis}{\operatorname{cis}}
\newcommand{\chr}{\operatorname{char}}
\newcommand{\Null}{\operatorname{Null}}
\definecolor{orange}{RGB}{255, 165, 0}
\definecolor{crimson}{RGB}{220,20,60}
\definecolor{pink}{RGB}{255,20,147}
\definecolor{darkGreen}{RGB}{34,139,34}
\definecolor{olive}{RGB}{128,128,0}
\definecolor{teal}{RGB}{0,128,128}
\definecolor{turquoise}{RGB}{64,224,208}
\definecolor{navy}{RGB}{30, 144, 255}
\definecolor{purple}{RGB}{128,0,128}
\definecolor{indigo}{RGB}{216, 191, 216}
\definecolor{maroon}{RGB}{128,0,0}
\definecolor{gold}{RGB}{255,215,0}
\definecolor{lemon}{RGB}{255, 250, 205}
\definecolor{peru}{RGB}{205, 133, 63}
\definecolor{alizarin}{rgb}{0.82, 0.1, 0.26}
\definecolor{brightmaroon}{rgb}{0.76, 0.13, 0.28}
\definecolor{cardinal}{rgb}{0.77, 0.12, 0.23}
\definecolor{tuscanred}{rgb}{0.51, 0.21, 0.21}
\definecolor{steelBlue}{rgb}{0.27, 0.51, 0.71}
\definecolor{tyrianpurple}{rgb}{0.4, 0.01, 0.24}
\def\Z{\mathbb Z}
\def\R{\mathbb R}
\def\Q{\mathbb Q}
\def\N{\mathbb N}
\def\C{\mathbb C}
\def\ba{{\mathbf{a}}}
\def\bb{\mathbf{b}}
\def\bh{{\mathbf{h}}}
\def\bu{{\mathbf{u}}}
\def\bv{{\mathbf{v}}}
\def\bw{{\mathbf{w}}}
\def\bx{{\mathbf{x}}}
\def\by{\mathbf{y}}
\def\bone{{\mathbf{1}}}
\def\bzero{\mathbf{0}}
\def\var{{\mbox{var}}}
\def\P{{\mathbb{P}}}
\def\E{{\mathbb{E}}}
\def\cA{{\mathcal{A}}}
\def\cB{{\mathcal{B}}}
\def\cC{{\mathcal{C}}}
\def\cP{\mathcal P}
\def\cF{{\mathcal F}}
\def\cE{\mathcal E}
\def\cO{\mathcal O}
\def\kin{k^{\mathrm{in}}}
\def\kout{k^{\mathrm{out}}}
\newcommand{\indeg}[1]{k^{\mathrm{in}}_{#1}}
\newcommand{\outdeg}[1]{k^{\mathrm{out}}_{#1}}
\tikzset{->-/.style={decoration={
markings,
mark=at position .5 with {\arrow{latex}}},postaction={decorate}}}
\newcommand{\pile}[1]{\bullet{#1}}
\newcommand{\ppile}[1]{\bullet({#1})}
\newcommand{\nim}[1]{*{#1}}
\newcommand{\bc}{C}
\newcommand{\R}{{\mathbb R}}
\def\nimsum{\, \oplus \,}
\def\mex{{\mathrm{mex}}}
\def\g{g}
\newcommand{\inter}{{\mathrm{int}}}
\def\cA{{\mathcal A}}
\def\cB{{\mathcal B}}
\def\cF{{\mathcal F}}
\def\cG{{\mathcal G}}
\def\cH{{\mathcal H}}
\def\cN{{\mathcal N}}
\def\cQ{{\mathcal Q}}
\def\cP{{\mathcal P}}
\def\W{{\mathbb W}}
\newcommand{\nimbleboard}[1]{
\begin{scope}[shift={(.25, .4)}]
\draw (0,-.3) -- (#1,-.3) -- (#1+.45, .7) -- (#1+.45, 1);
\draw (0,0) -- (#1,0);
\draw (.45,1) -- (#1+.45,1);
\foreach \i in {0, ..., #1} {
\draw (\i, -.3) -- (\i, 0) -- (\i+.45,1);
}
\foreach \i in {1, ..., #1} {
\node[style={font=\sffamily\scriptsize}] at (\i - .5, -.15) {\i};
}
\end{scope}
}
\newcommand{\coin}[1]{
\begin{scope}[shift={#1}]
\draw[color=white, fill=white] (-.4, 0) -- (-.4, -.1) -- (.4,-.1) -- (.4,0) -- cycle;
\draw[thick, fill=white] (0,0) ellipse (0.4 and 0.10);
\draw[thick, fill=white] (.4,-.1) arc (0:-180:0.4 and 0.10);
\draw[thick] (0.4,0) -- (0.4, -.1);
\draw[thick] (-0.4,0) -- (-0.4, -.1);
\end{scope}
}
\newcommand{\bean}[2]{
\begin{scope}[shift={#1}, rotate={#2}]
\draw [very thick, fill=gray!50] plot [smooth cycle] coordinates {(-.2,0) (-.175, .07) (-.1,.1) (0,.075) (.1,.1) (.175, .07) (.2,0) (.15, -.07) (0,-.1) (-.15, -.07)};
\end{scope}
}
\newcommand{\heap}[2]{
\begin{scope}[shift={#1}]
\draw[very thick] (0,0) circle ({#2});
\end{scope}
}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\)
Section 3.1 Mex
In the first two chapters, we cracked the game of Nim: the nim value of a Nim position determines the winner. However, Nim is not the only game in town. The goal of this chapter is to introduce a broader framework that applies to all impartial combinatorial games. Our investigation will culminate in the Sprague-Grundy value of a game position.
The heart of the Sprague-Grundy value is a function called mex. The domain of the mex function is the set of subsets of the whole numbers \(\W = \{ 0 ,1, 2, 3, \ldots \}\text{.}\) The domain is also called the power set of \(\W\text{,}\) and is denoted by \(\mathcal{P}(\W)\text{.}\) The mex of a set \(S \in \mathcal{P}(\W)\) is the least whole number that does not appear in \(S\text{.}\) In other words, the function \(\mex : \mathcal{P}(\W) \rightarrow \W\) is given by
\begin{equation*}
\mex (S) = \min \{ i \in \W \mid i \notin S\}.
\end{equation*}
Here are some examples:
\begin{equation*}
\begin{array}{rcl}
\mex ( \{0, 1, 3 \} )&=&2 \\
\mex ( \{1, 2, 3 \} )&=& 0 \\
\mex (\{0, 3, 6 \}) &=& 1 \\
\mex (\{2, 4, 6 \}) &=& 0 \\
\mex (\{0,1,2,3, 5, 7,9 \}) &=& 4 \\
\mex ( \emptyset )&=& 0
\end{array}
\end{equation*}
So the mex of a set is the smallest missing whole number. Like the nim value, we will be particularly interested in whether the mex of a set is zero or nonzero. Therefore, we want to emphasize that
Fact 3.1.1.
\(\mex (S)=0\) if and only if \(0 \notin S\text{.}\)
Note that \(\mex( \emptyset) = 0\) since the number \(0\) is certainly the smallest number that is not a member of \(\emptyset\text{.}\)
We stress that the mex function assigns a whole number to a set of numbers. We are interested in assigning a number to a position of a game. To avoid confusion, we will follow two conventions.
First, we will restrict the term "mex" to sets of numbers, and use the term "Sprague-Grundy value" for the number assigned to a game position.
-
Second, we need a new notation for a nim heap of size \(n\text{.}\) From this point forward, we will use the symbol \(\nim{n}\) for this game position. The nim game with heap sizes \(5, 3, 8\) will now be denoted by
\begin{equation*}
\nim{5} \oplus \nim{3} \oplus \nim{8},
\end{equation*}
rather than by \(\{5,3,8\}\text{.}\)
Our definition for Sprague-Grundy value is recursive, based on the values of the followers of the position.
Definition 3.1.2.
Let \(\cG\) be a combinatorial game and let \(X\) be a position in this game. Let \(\cF(X) = \{Y_1, Y_2, \ldots , Y_k \}\) be the followers of position \(X\text{.}\) Then the Sprague-Grundy value of \(X\) is
\begin{equation*}
\g(X) = \mex \{ \g(Y_1), \g(Y_2), \ldots , \g(Y_k) \}.
\end{equation*}
We make two quick observations. First, if game position \(X\) has no followers then \(\g(X) = \mex (\emptyset) = 0\text{.}\) Second, if position \(X\) has followers \(\cF(X) = \{ Y_1, Y_2, \ldots , Y_k \}\) then \(\g(X)\) might still be zero: it depends on whether any of the followers have zero Sprague-Grundy value.