# Games Which are Impossible to Analyze

In the last post, I mentioned the computational complexity of various games. To be explicit, we consider each “game” $G$ to actually be a sequence of games $\{G_n\}$ for $n\in \mathbb{N}$. For example, $\text{checkers}_n$ would be checkers played on an $n\times n$ board. The problem was then to analyze the computational complexity of the function which takes $n$ and tells you which player has a winning strategy and what the winning strategy is. I’ll call that function the analysis function of $G$.

Are there any games which can actually be played in the real world with an undecidable analysis function? Robern Hearn, in the same thesis that I linked to last time, showed that the answer is yes.

In order to make sure that our games can be played in the real world, we’ll restrict our attention to games $G$ where each $G_n$ has only finitely many positions (that is, the board has only finitely many states it can be in).

First off, observe that if $G$ is a game of perfect information, then it has a decidable analysis function. By the fact that there are only finitely many positions in each $G_n$, you can construct a finite game tree for $G_n$ (finite because you can cut it off when positions repeat) and then induct up it to find out who has a winning strategy.  (You may want to think about this if you haven’t seen it before.  This is something like what is sometimes called Zermelo’s Theorem.)

OK, so let’s look at games $G$ which are not of perfect information, i.e., each of the players have some private information. Now it’s possible that no player has a winning strategy (for example, consider the two-player game where both players secretly choose either 0 or 1, and if the sum is odd then Player 1 wins, and if it’s even then Player 2 wins). Even so, the question of which, if any, players have a winning strategy is well-defined.

It turns out that these also have decidable analysis functions. I’ll also omit this proof, but it’s similar to the above except that, instead of a finite tree of positions, you can construct, for each player, the tree of subsets of positions that he considers possible at any given time.

So what hope is there? I said that both games of perfect information and games of imperfect information have decidable analysis functions. But there was an unstated assumption: that all players are playing against each other. Hearn showed that a game with two players who are playing as a team against a third player but such that each of two team members has private information (which they are not allowed to communicate) can be undecidable.

The idea of the proof is as follows: Imagine that we have three players, Player 1, Player 2, and Player 3, and that Players 2 and 3 are playing as a team against Player 1.  In order to make the analysis function undecidable, we would like to do something like (say) in game $G_n$ force Player 2 to emulate the $n$th Turing machine and have his team wins if it halts.  But we can’t literally make the board an infinite tape and make Player 2’s legal moves be those simulating the $n$th Turing machine, because then the board would have infinitely many positions.

But what if, instead of an infinite tape, the board was a single cell where Player 2 wrote out the computational history of the $n$th Turing machine one character at a time?  That is, if $s_t$ represents the (finite) contents of the tape at time $t$, he writes out the concatenation of all the $s_t$ (with, say a special symbol # separating them).  This would be good, but how can we enforce this given that we want the set of legal moves to depend only on the board position?

The solution is the following:  We require both Player and Player 3 to write out the computational history of the $n$th Turing machine in two separate “streams”.  Player 1 lets each of them know which stream he wants them to to write a character to at any given time.  Player 1 can then check them against each other by advancing one of them ahead of the other in one of the streams and checking, character by character, that the string that one of them is writing out is one step further along the computational history of the $n$th Turing machine than the string that the other is writing out.  Since Player 2 and Player 3 do not know who is advanced relative to the other, they will not be able to cheat.

Hearn uses this argument to show that a game he calls Team Computation has an undecidable analysis function.  He then uses that to show that the team version of Constraint Logic (discussed in the previous post) is undecidable.