# A game on a smaller graph

In this question Alice and Bob play a game on $K_{2014}$, Alice directing one edge, Bob directing $1$ to $1000$ edges with Alice trying to make a cycle. The proof that Alice can win depended on the fact that Bob's maximum number of edges was less than half the number of vertices. I believe that in fact if Bob's maximum number of edges on $K_n$ is $n-3$ or less Alice can win. Bob can win with $n-2$-after Alice's first move, he directs all the other edges leaving from the root of Alice's edge outward and continues in that vein. I think the proof that Alice can win will depend on showing Bob really doesn't want to play edges until he needs to, and then at the end he can't play quite enough.

For a more tractable example, take $K_8$ and allow Bob $5$ moves. As there are only $28$ edges, in theory the game could be done in five moves. But let Alice move $1\to 2$ If Bob plays five more edges leaving $1$, Alice plays the other edge into $1$ and wins. If Bob plays $3 \to 4$, Alice can play $2 \to 3$ and has a chain of three. Bob has to use three of his moves $1 \to 3, 1\to 4, 2 \to 4$ and doesn't want to play any more. Now Alice will win by $4 \to 5, 5 \to 6, 6 \to 7$ unless Bob leaves something open earlier. Bob's best first move is probably just $1 \to 3$, but even then Alice can take advantage by playing $4 \to 1$ and so on. It isn't a proof, but the more I play with it the more convinced I become.

Can we prove that Alice wins on $K_8$ with Bob having at most $5$ moves? That is easily accessible to exhaustive search. Can we prove it for $K_n$ with Bob having $n-3$ moves?

• “If Bob plays $3\to4$, Alice can play $2\to3$ and has a chain of three.” What if Bob plays both $3\to4$ and $3\to2$? Jun 26, 2014 at 1:52
• @SteveKass: Alice can play $5 \to 3$, threatening $4 \to 5$, so Bob has to play $5 \to 4$. Alice is also threatening to play $6,7,8 \to 5$ and $4 \to 6,7,8$ There will be too many for Bob to block, I believe. Sep 30, 2014 at 21:17
• I agree that this should go to puzzling, but there is a time limit on when a question can be migrated. I think (though I may be wrong) that it's 3 months, so we just missed it here. Oct 2, 2014 at 16:05

I recently bumped into this old post and wrote a program to check by enumeration who wins on $K_n$ if Bob can orient $b$ edges at each turn.

The program requires significant computing resources even for small values of $n$. I'm not sure my approach can be pushed beyond $n=8$, but here's what I found so far for the least value of $b$ for which Bob has a winning strategy:

$$\newcommand\T{\Rule{0pt}{1em}{.3em}} \begin{array}{c|c|c|c|c|c|c|c} n \T & 3 \T & 4 \T & 5 \T & 6 \T & 7 \T & 8 \T & 9 \T \\\hline \text{least } b \T & 1 \T & 2 \T & 3 \T & 3 \T & 4 \T & 5 \T & \leq 6 \end{array}$$

This suggests that the conjecture that Alice wins when $b \leq n-3$, if it holds, holds for $n \geq n'$, with $n' > 8$. My program computes the strategy for the winner and verifies it, but the verifier code is not fully independent from the strategy computation code. There's a small chance that both are wrong. Details of both phases follow. The computed strategies are too unwieldy to post, but one of Bob's allegedly winning replies to Alice's opening move $(1,2)$ is

$$(1,3), (1,4), (1,5), (1,6), (7,2) \enspace.$$

The computation of the strategy works on a graph whose vertices (configurations) are triples $(t, F, B)$, where $t \in \{\text{Alice}, \text{Bob}\}$ indicates whose turn it is to move, while $F$ and $B$ are disjoint subsets of edges of $K_n$ that have been oriented in the forward direction ($(i,j)$ with $i<j$) and backward direction ($(i,j)$ with $j < i$), respectively. Let $C$ be the set of all configurations that satisfy these restrictions. For $n=8$, $|C| = 2 \cdot 3^{28} \approx 4.5754 \cdot 10^{13}$.

The initial configuration is taken, w.l.o.g., to be $(\text{Bob}, \{(1,2)\}, \emptyset)$. Alice's target configurations are those configurations in $C$ that contain an oriented triangle. Since the presence of an oriented cycle obviously implies the eventual presence of an oriented triangle, Alice's ability to force an oriented cycle is tantamount to her ability to force an oriented triangle. This is convenient because the set of configurations that contain triangles is easy to describe:

\begin{align} T &=\{(t,F,B) \in C \mid \exists\, i,j,k \,.\, i < j < k \wedge (i,j) \in F \wedge (j,k) \in F \wedge (i,k) \in B\} \,\cup \\ &\quad\,\,\{(t,F,B) \in C \mid \exists\, i,j,k \,.\, i < j < k \wedge (i,j) \in B \wedge (j,k) \in B \wedge (i,k) \in F\}\enspace. \end{align} Note that for given $F$ and $B$, $T$ contains both $(\text{Alice},F,B)$ and $(\text{Bob},F,B)$, because the last move may be made by either player. For $n=8$, $|T| = 2 \cdot 21834063047916$.

Alice has a transition relation, that is, a collection of pairs of configurations $(c,c') \in C^2$ such that she can move from $c$ to $c'$ by orienting an hitherto undirected edge:

\begin{align}\tau_A &= \{((\text{Alice},F,B),(\text{Bob},F',B')) \in C^2 \mid \\ &\quad\quad F \subseteq F' \wedge B \subseteq B' \wedge |F'|+|B'| = |F|+|B|+1\} \enspace.\end{align}

Bob's transition relation allows him to orient between $1$ and $b$ hitherto undirected edges:

\begin{align}\tau_B &= \{((\text{Bob},F,B),(\text{Alice},F',B')) \in C^2 \mid \\ &\quad\quad F \subseteq F' \wedge B \subseteq B' \wedge |F|+|B|+1 \leq |F'|+|B'| \leq |F|+|B|+b\} \enspace.\end{align}

For $n=8$, $|\tau_A| = 427033459159272$, while $|\tau_B|$ varies with $b$. Given a transition relation $\tau$ and a set of configurations $Z$, we define $\DeclareMathOperator{\pre}{pre}$

$$\pre(\tau,Z) = \{c \in C \mid \exists\, c' \in Z \,.\, (c,c') \in \tau\} \enspace.$$

Alice's winning configurations are obtained by iteratively computing

\begin{align} Z &= Z \cup \pre(\tau_A,Z) \\ Z &= Z \cup \pre(\tau_B,Z) \cap (\pre(\tau_B,Z^c))^c \enspace, \end{align}

where $X^c = C \setminus X$, starting from $Z=T$ and continuing until convergence. The resulting $Z$ is the set of configurations that Alice can control to configurations in $T$. Alice's update says that every configuration from which Alice can move to one of her winning configurations is winning for Alice. Bob's update says that every configuration from which Bob can move, but is forced to move to one of Alice's winning configurations, is winning for Alice. For $n=8$ and $b=4$, Alice has $22853813741592$ winning configurations out of $22876792454961$ configurations from which she moves.

If the least fixed point, $Z_\infty$, of the above iteration contains the initial configuration, Alice wins; otherwise Bob wins. Alice plays a reachability game, and Bob plays a safety game. Both these games have positional strategies.

Bob's winning strategy from a configuration in $Z_\infty^c$ amounts to choosing any other configuration in $Z_\infty^c$ that is reachable in one step according $\tau_B$. Alice's winning strategy from a configuration in $Z_\infty$ amounts to choosing any other configuration in $Z_\infty$ that is reachable in one step according to $\tau_A$. While in general a player with a reachability objective must choose moves so as to make progress towards the goal, Alice's progress is ensured by the guaranteed decrease of $n - |F| - |B|$ at each move.

The verification part of the program checks whether it is indeed possible for Alice to keep Bob inside $Z_\infty$ or for Bob to keep Alice outside of it when starting from the initial configuration---depending on who's the winner. For that, it makes use of $\DeclareMathOperator{\post}{post}$

$$\post(\tau,Z) = \{c \in C \mid \exists\, c' \in Z \,.\, (c',c) \in \tau \} \enspace,$$

checking whether $\post(\tau_B, Z_\infty) \subseteq Z_\infty$ if Alice wins, and whether $\post(\tau_A, Z_\infty^c) \subseteq Z_\infty^c$ if Bob wins.

At the implementation level, configurations are encoded by $1+n(n-1)$ binary variables---one for the turn and two for each edge---and the program manipulates the characteristic functions of the encodings of sets and relations.