The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they...

33
The Computational Complexity of Games and Puzzles Valia Mitsou

Transcript of The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they...

Page 1: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

The Computational Complexity of Games and

Puzzles

Valia Mitsou

Page 2: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

Abstract

The subject of my thesis is studying the algorithmic properties of oneand two-player games people enjoy playing, such as chess or Sudoku. Thisresearch falls into a wider area known as combinatorial game theory. Oneof the main questions asked about games in this context is whether they arealgorithmically tractable, that is, whether they can be solved with efficientalgorithms.

So far, more than fifty popular games have been categorized as intractable.This is probably because people enjoy games and puzzles for which designinga winning strategy or finding the solution requires some cleverness.

Page 3: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

Contents

1 Introduction 2

2 Computational complexity background 4

2.1 Complexity classes for games and puzzles . . . . . . . . . . . . 4

2.2 The class PSPACE . . . . . . . . . . . . . . . . . . . . . . . . 6

2.2.1 Generalized Geography . . . . . . . . . . . . . . . . . . 7

2.3 Parameterized complexity primer . . . . . . . . . . . . . . . . 10

2.3.1 Structural Parameters . . . . . . . . . . . . . . . . . . 12

2.3.2 Parameterized Complexity for puzzles and 2-player games 15

3 The Game of UNO 16

3.1 Single player version of UNO . . . . . . . . . . . . . . . . . . . 17

3.2 Many-player uncooperative version . . . . . . . . . . . . . . . 20

4 The Game of SET 21

4.1 One round of SET . . . . . . . . . . . . . . . . . . . . . . . . 22

4.2 Multi-round versions . . . . . . . . . . . . . . . . . . . . . . . 25

4.3 A two-player game . . . . . . . . . . . . . . . . . . . . . . . . 27

1

Page 4: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

1 Introduction

Combinatorial Game Theory is a very intriguing and widely developed field of

mathematics and computer science under the wide umbrella of Recreational

Mathematics. A combinatorial game is usually considered to be a 2-player

turn-based finite game with perfect information (no player hides any infor-

mation from her opponent) and no chance, like chess or go. Similarly, finite

1-player puzzles of no chance, like sudoku or mastermind also fall into this

category. Other than the practical applications that studying games and

puzzles has in the gaming market, combinatorial game theory is a field that

many people inside and outside the academic community find insteresting

and amusing.

Since many games and puzzles are entertaining while having at the same

time mathematical and algorithmic depth, they serve as a great teaching

tool. For example, Prisner in university of Maryland used a river crossing

puzzle in his Discrete Mathematics class. Many games and puzzles can be

directly reformulated as well-known important algorithmic problems. To give

some examples, solving the river crossing riddle we just mentioned is very

close to solving Vertex Cover, playing the game UNO as we present in

section 3 can be modeled as solving Hamiltonian Path, different versions

of the game SET as we present in section 4 can be reformulated as covering

or matching problems, the game “lights out” can be viewed as some version

of parity domination [22], etc. To take this to some extent, studying a game

or a puzzle with a direct algorithmic application might give results which are

important even outside of the field.

Furthermore, all people learn and play games and puzzles and this pro-

vides a connecting bond between the academic and the non-academic com-

munity: research results in combinatorial game theory are more likely to be

read, understood and appreciated by people ouside of academia. Recent the-

2

Page 5: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

oretical results have appeared in blogs of popular science (see for example

Tetris is hard, even to approximate: addictive puzzle even stumps comput-

ers, Mathematicians Prove Tetris Is Tough, And Scrabble proved PSPACE-

Complete, How Complicated is Scrabble, Lemmings Forum, The Complexity

of Tip Over and other puzzles). In addition, studying games and puzzles

from an algorithmic point of view can enhance cross-disciplinary research, as

people outside of the field but interested in the said game might read research

results about it.

When we study a 2-player game, one of our main goals is to figure out

which player is going to win. It is worth mentioning here that, for the

class of games that we study (turn-based, finite, perfect information, and no

chance), this is always going to be the same player (or always a draw) if both

players play optimally. The strongest way of determining (and enforcing) the

outcome is by designing a winning strategy : an algorithm that, for any move

of the opponent, can provide us with a choice that if the player follows, she

will eventually win the game (or force a draw if the outcome is a draw). For

most interesting games though, designing an algorithm that works efficiently

is particularly difficult due to the combinatorial explosion of the number

of potential next moves. In some cases, we could prove that a player has

a winning strategy by giving a non-algorithmic proof. Even in that case it

can again be particularly complicated to describe the actual winning strategy.

For many well-known games, such as chess, it is still unknown if either player

has a winning strategy. The complexity to find a winning strategy to a game

is usually what makes the game interesting.

In the case of an 1-player puzzle, the objective is to find the solution to the

puzzle. Likewise, that can be determined by designing a solving alorithm or

giving a non-algorithmic mathematical argument. In some cases it is fruitful

to consider the question whether the puzzle is solvable or not, which can be

tackled in a similar way. Again, solving a puzzle is usually a slow procedure,

3

Page 6: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

because most of the times it requires an exaustive search in the set of potential

plays. For example, though Sudoku is easy for modern computers for 9 × 9

boards, it can quickly become impossible to decide if a larger Sudoku instance

has a solution, because we know of no (significantly) better algorithm than

trying out all solutions. Again, the complexity of a puzzle is what makes it

interesting to play, unless the amusement comes from figuring out a clever

trick to solve it (which renders the puzzle useless once you know the trick).

It thus becomes natural to ask this question: for which games or puzzles is

it always possible to decide on an optimal next move efficiently, even for large

instances? Such questions are usually answered with the tools of computa-

tional complexity theory, a theory which categorizes algorithmic problems as

tractable or intractable depending on the resources needed to solve them.

2 Computational complexity background

2.1 Complexity classes for games and puzzles

In computational complexity theory resources are measured as functions of

the size of the input. Thus any finite-sized puzzle or game is considered

trivially solvable. So, when we study a puzzle or a 2-player game from the

computational complexity point of view, we first need to create a natural un-

bounded generalization of the puzzle or game. For example, in a board game

we consider a variation where the board is of size n× n. Usually, algorithms

with a polynomial (in n) complexity are considered efficient and algorithms

with an expenential complexity are considered inefficient or impractical.

To characterize the computational complexity of a game we can do two

things. If the game is tractable we must demonstrate an efficient algorithm

that solves it. If it is not, we must show that such an algorithm cannot exist.

The second task is generally more complicated (since we must rule out all

4

Page 7: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

conceivable algorithms). Usually, evidence of intractability takes the form of

a hardness proof that shows that if an efficient algorithm for the game exists

some widely believed complexity conjectures are proved false.

The most celebrated theory for proving hardness results is the theory of

NP-Completeness, invented by Cook in 1971 ([6]) and further developed by

Karp in 1972 ([26]). From the time that it was introduced, more than 1000

problems have been characterized as NP-complete (i.e. problems that it is

efficient to verify a suggested solution but probably inefficient to compute

it). Furthermore, one of the most important open problems in complexity

theory (and computer science in gereral) is the famous P=NP question (i.e.

whether NP-complete problems admit efficient algorithms).

Similar to the example of NP-completeness, theorists have introduced sev-

eral other hardness complexity classes to characterize possibly more difficult

problems. Some of them are for example the class of PSPACE-complete prob-

lems (problems not requiring a lot of additional memory space to be worked

out but probably requiring a lot of time) and the class of EXPTIME-complete

problems (problems known to be inefficient from a time perspective).

Intractability for games and puzzles takes the form of a hardness proof.

When we say that a game or puzzle is NP-complete, we mean that it is

hard to find its solution efficiently, but easy to verify the correctness of a

given solution. For a PSPACE-complete problem, verification is also hard

but at least polynomial termination of the game is guaranteed. Harder games

without such a termination guarantee usually turn out to be EXP-complete.

Many of the famous 1-player games and puzzles are usually shown to be

NP-Complete. Examples include (among others) sudoku [32], mastermind

[31] and tetris [11]. This is definitely not a coincidence: people enjoy spending

time on an intractable puzzle, such as Sudoku, but also appreciate the ability

to easily check the solution for correctness, once it’s done.

On the other hand, hard 2-player games are usually at least PSPACE-

5

Page 8: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

hard. That is so because in order to be sure that some player has a winning

strategy, for each move we have to check all the possible moves that the oppo-

nent can make. Examples include (among others) chess [19], go [28] and oth-

ello [25]. For an extensive list of NP-Complete and PSPACE-Complete games

and puzzles see http://en.wikipedia.org/wiki/List_of_NP-complete_

problems#Games_and_puzzles and http://en.wikipedia.org/wiki/List_

of_PSPACE-complete_problems#Games_and_puzzles.

2.2 The class PSPACE

The class PSPACE is considered the natural home of 2 player games. The

reason is that Quantified Boolean Formula, the variation of satisfiabil-

ity which is complete for PSPACE, can be viewed as a two player game where

players set truth values of the variables used in a formula φ interchangeably.

If φ is satisfied then player A wins, else player B wins.

Definition 2.1. Problem: Quantified Boolean Formula.

Input: A first order formula ∃x1∀x2∃x3 . . . ∀xnφ(x1, x2, x3, . . . xn) with φ be-

ing in CNF.

Question: Is φ satisfiable?

Theorem 2.1. (from [29]) Quantified Boolean Formula is PSPACE-

Complete.

Quantified Boolean Formula can be seen as a two player game: If

player A can pick a truth value for x1 such that for any truth value player

B might pick for x2 then player A can pick a truth value for x3, and so on,

such that in the end the formula is satisfied, player A wins. On the other

hand, if for any x1 that player A picks there is a truth value for x2 that

player B picks, and so on, such that in the end the formula is false, then

player B wins. Quantified Boolean Formula is a very useful problem

6

Page 9: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

for proving hardness of 2-player games. Below we present a famous 2-player

game called Geography.

2.2.1 Generalized Geography

The problem Generalized Geography is inspired by the school game of

Geography usually played by two players: Player A starts the game with

introducing the name of a city, for example “New York”. Then player B

should find a city the name of which starts with the last letter of the previous

city played, for example “Kyoto”. Player A continues in the same way,

playing for example “Osaka”, player B playing “Athens” and so on and so

forth. A city that was already played cannot be played again. The first

player unable to find a city to play loses.

Variations of this game can be found in many countries. For example in

the US the game is called “States” (the theme is US states), in Russia it’s

called “Goroda” (trans. “cities”), and in Japan it is called “Shiritori” (trans.

“taking the end”). In a similar game played in Greece, the theme is “songs”.

Definition 2.2. Problem: Generalized Geography.

Input: A directed graph G(V,E) and a starting vertex v ∈ V .

Description: Two players take turns moving a token (initially placed in v)

from a current vertex to a neighboring vertex following the direction of the

arcs. When a vertex is visited, it is removed from the graph. First player

unable to move loses.

Question: Is there a strategy so that player 1 wins?

Generalized Geography is one of the most common games used

in proving PSPACE-hardness for other games. Here we prove that it is

PSPACE-hard.

Theorem 2.2. (from [29]) Directed Generalized Geography is PSPACE-

hard

7

Page 10: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

Figure 2.1: Geography game: the variable gadget.

Proof. We reduce Quantified Boolean Formula to Generalized Ge-

ography. The construction is as follows.

Suppose we are given a first order formula ∃x1∀x2 . . . ∃xnφ. We construct

a graph as follows: For each variable xi we construct a diamond-like variable

gadget as shown in figure 2.1. The player who gets to choose whether some

variable xi will be set to true or false is the one responsible to move the token

in the corresponding variable gadget to up or down. We put many variable

gadgets one after the other to represent the alternating choice in truth values

of variables by the players. In the end, player B should choose which clause

player A should satisfy. So we create one vertex cj for each clause and connect

the last gadget vertex with each clause vertex with arcs. We also connect

a clause vertex with the literals that it contains in the following manner: if

variable xi appears in the clause cj as positive, then we connect vertex cj with

the vertex that corresponds to xi = F , otherwise if it appears as negative,

we connect cj with vertex from the variable gadget xi that corresponds to

xi = T . We need to make sure that the choice of clause to be satisfied is

made by player B. So we might need to add an additional vertex after the

variable gadgets depending on the parity of the number of the alternating

quantifiers. For an example see figure 2.2.

There are many variations of Generalized Geography. One is Edge

8

Page 11: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

Figure 2.2: A complete example transforming the first order formula∃x∀y∃z((¬x∨ y ∨ z)∧ (x∨ y ∨¬z)) into a geography game. Game starts onthe purple node with player A setting the truth value of variable x. PlayerB on the yellow node picks which clause is to be satisfied.

Generalized Geography, where instead of vertices we remove visited

edges from the graph. Generalized Geography and Edge General-

ized Geography are both proven to be PSPACE-complete even on bipar-

tite or on planar graphs with in/out degrees at most 2 and total degree at

most 3 (see [21] and [28]). Furthermore, both vertex and edge versions can

be played in an undirected graph instead of a directed. In [20], Undirected

Vertex Generalized Geography is proven to be in P, whereas Undi-

rected Edge Generalized Geography is proven PSPACE-complete

(though its restriction to bipartite graphs is shown to be in P).

Theorem 2.3. (from [20]) Undirected Generalized Geography is

solvable in polynomial time.

Proof. We reduce Undirected Generalized Geography to Maximum

Matching. We prove that player 1 has a winning strategy iff v is matched

in every maximum matching of G.

If v is matched in every maximum matching, then consider one such

9

Page 12: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

matching M in G. Player 1 will play over edges of M . Observe that the

edges that player 2 plays over also constitute a matching M ′ in G. However,

M ′ can’t be as large as M because then it would be a maximum matching

that doesn’t cover v. So |M | ≥ |M ′| and player 1 wins.

On the other hand, if M is a maximum matching that doesn’t match v,

it should match all of its neighbors (otherwise if there was a u neighbor of

v that was also unmatched, we could include (u, v) in M). So now player 2

can play on the edges of the matching and guarantee a winning strategy.

Deciding whether all maximum matchings match v can be done by com-

puting the maximum matching on G and then on G \ v and comparing the

sizes. If they are equal, there exists a maximum matching in G that doesn’t

match v, otherwise v is always matched by a maximum matching in G.

2.3 Parameterized complexity primer

Classical complexity theory mostly focuses on the distinction between poly-

nomially solvable vs exponentially solvable problems in terms of the size of

the input (n). Parameterized Complexity refines this distinction by intro-

ducing yet another parameter of the problem (k) and classifying problems

as tractable or intractable when this parameter is small or moderately large.

For example, consider the following problems: Vertex Cover, Indepen-

dent Set, Graph Coloring. All 3 are well-known NP-Hard problems.

However, the first two become polynomially solvable if we know that the

size of the solution is a constant, whereas the third is NP-hard even for 3

colors. The class of problems that admit polynomial time algorithms when

the parameter is a constant is called XP.

Parameterized complexity theory comes with its own notions of tractabil-

ity and intractability. A problem is considered Fixed Parameter Tractable

(abbrev. FPT) when exponential growth in the complexity of the problem

10

Page 13: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

is confined in a function of just the parameter, in other words if the problem

admits an algorithm with complexity O(f(k) · nc). FPT algorithms are con-

sidered more efficient than their XP counterpart with running time O(nf(k))

for moderately large values of k. Vertex Cover parameterized by the size

of the vertex cover admits an easy FPT algorithm: Pick an uncovered edge

(u, v) and consider covering it first by u and then by v. Remove (u, v) to-

gether with all edges having either u or v as an endpoint. Repeat for up to

k steps. If all edges are covered reply yes. If not, reply no.

On the other hand, Independent Set parameterized by the size of the

independent set is not known to admit an FPT algorithm. It is also unlikely1

to admit one, as this problem is proven to be W-hard. The W-hierarchy is

an analogue of the polynomial hierarchy of classical complexity theory to

parameterized complexity. Classes W[t] are defined as the classes for which

the Weighted t−Normalized Satisfiability problem is complete.

Definition 2.3. Problem: Weighted t−Normalized Satisfiability

Input: A t-normalized boolean expression F , a positive integer k

Parameter : k

Question: Does F have a satisfying truth assignment of weight k? That is,

a truth assignment where precisely k of the variables which appear in F are

true?

In the definition, t stands for the number of alternations between conjunc-

tions and disjunctions in the formula F . A CNF formula can be viewed as

the conjunction of bracketed disjunctions, so it has only one alternation level

and is 1-normalized. If we were to substitute some literals in a CNF formula

with bracketed conjunctions, the result would be a 2-normalized formula.

As with classical complexity theory, in parameterized complexity theory

we have developed a reduction program. If a problem A is FPT-reducible

1unless the exponential time hypothesis (abbrev. ETH) is proven false, that is thereexists a 2o(n) algorithm to solve 3−SAT.

11

Page 14: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

to another problem B and we can solve B in FPT time, then we can also

solve A in FPT time. On the other hand, a problem B can be proven to be

W-hard (or AW-hard) when, starting by a known hard problem A we can

reduce A to B via an FPT time reduction, as long as the parameter in B is

a function of just the parameter of A (independent of the input size).

Classes W[1] and W[2] are the most commonly seen, and many param-

eterized problems have been categorized as complete for these classes. In-

dependent Set is an example of a W[1]-complete problem, together with

Clique. On the other hand, Dominating Set and Hitting Set are W[2]-

complete. Yet another complete problem for W[1] is the k-Multicolored

Clique problem, one of the most famous problems that is used to prove

parameterized hardness (see [16]).

A quantified variation of t−normalized SAT Parameterized QBFSATt,

is complete for the class AW[t] [1]. AW[t] for t = 1, 2, . . ., is also a hierarchy

of classes which has been collapsed (see [1]) and is now known as AW[*].

In this parameterized geography of classes, the class XP can be seen as

the parameterized equivalent of the class EXP of classical complexity. A

problem which is hard for XP cannot be in FPT [14].

2.3.1 Structural Parameters

In addition to natural parameters (i.e. the parameter being the size of the

solution), one can consider other parameters - quantities or measures which

when they are small constants the problem can be solved in polynomial

time. One of the most celebrated such examples is the notion of treewidth.

In simple terms, treewidth measures how much a graph resembles a tree. For

a graph, having small treewidth essentially means that it has small cuts. A

graph with small treewidth can be re-written in a tree-like structure called

a tree decomposition where every node is a small cut of the original graph.

Then, one can explore this tree-like structure to develop dynamic programs

12

Page 15: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

to solve a number of different problems.

Treewidth is one of the most celebrated structural parameters. First of

all, the problem of finding whether a graph has treewidth at most k is FPT.

Second, by Courcelle’s theorem [8], every problem expressible in monadic

second order logic is FPT parameterized by treewidth and solvable in linear

time when treewidth is a constant.

Researcher have tried to reproduce treewidth’s success and have intro-

duced many different structural parameters. We will analyse clique-width,

since this will prove useful later.

In order to describe clique-width we need to define the following 4 oper-

ations:

1. Construct a new vertex with any color among {1, 2, . . . k};

2. Take the union of two colored graphs of up to k colors each;

3. Take the join between two colors i, j, in other words connect all vertices

of color i to vertices of color j;

4. Rename color i to color j.

A graph G(V,E) is said to have click-width k if it can be constructed

using at most k colors and the above operations.

Graphs of bounded treewidth also have bounded clique-width but not

vice versa, which makes the class of graphs of bounded clique-width more

general [7]. Clique-width was introduced in lack of a measure to describe

classes of dense graphs which might have a simple enough structure. For

example, cliques have unbounded treewidth, but have clique-width 2: First,

construct a vertex of color 1, then repeatedly:

• construct a vertex of color 2 ;

• join all vertices of color 1 to the vertex of color 2;

13

Page 16: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

• recolor vertex of color 2 to color 1.

Unfortunately, it is shown that computing the clique-width of a graph is

NP-hard [17], though it is still unknown if it is W-hard. However, the class of

graphs of bounded clique-width is interesting, because many NP-Complete

problems become polynomially solvable for this class. For example, all graph

properties expressible in MSO1 logic, in other words if we allow quantification

over sets of vertices (but not sets of edges) are decidable in linear time in

graphs of constant clique-width [9]. Furthermore, many other problems have

been shown to be tractable for constant clique-width, see [15]. Here we

present an algorithm to solve Hamiltonian Path.

We design a dynamic program that works as follows: we store information

about all different path covers over all pairs of colors of the graph in a multiset

M , then we extend the multiset for each operation that we perform. A path

cover of the graph is a union of vertex disjoint paths that cover the graph. A

Hamilton path is a path cover that is a unique path. Thus, if after computing

M for graph G, if M contains some path cover which is a unique path we

reply yes, else we reply no.

Here we show how to update the multiset after performing one of the

four operations described above. Suppose that we have a multiset M that

contains information about all different path covers of the graph so far. The

operations 1,2, and 4 (add vertex, union, rename) are easy. For the first,

if the added vertex has color i, add the path < i, i > in all path covers of

M . For the second, combine all the path covers of the first with the path

covers of the second. For the last, if we are to rename all vertices of color

i to color j, we construct M ′ by substituting i with j everywhere in M .

The join operation is the most difficult to explain. If we are to connect all

vertices of color i to vertices of color j then potentially some new paths will

be constructed. Thus, for every path cover in M that contains < i, k > and

< l, j >, we add in the multiset this path cover and also a path cover where

14

Page 17: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

< k, i >,< j, l > is replaced by < k, l >.

The size of the multiset in any given time is at most O(|V |k2). Further-

more, it is polynomial in the size of the multiset to compute M ′ for each

operation, and the number of operations for any reasonable expression of

clique-width is polynomial in the size of the input. Thus:

Theorem 2.4. Hamiltonian Path can be solved in polynomial time in

graphs of bounded clique-width.

2.3.2 Parameterized Complexity for puzzles and 2-player games

In puzzles and games as well as in regular problems, one can identify impor-

tant parameters that are known to be small for the particular game or puzzle

and examine its complexity from the parameterized point of view. It is quite

usual for games and puzzles to have natural parameters apart from the input

size. For example, in a card game like UNO, one can consider the number of

colors as a parameter (in the real game this number is 4: red, blue, green,

yellow).

In [1], Abrahamson, Downey, and Fellows introduced the concept of a

short or k-move game. This concept can be viewed as a generalization of the

mate-in-k-moves problem from chess, and creates a parameter which can be

applied to every combinatorial game which can be played in rounds. Short

games are also very much in line with the standard heuristic approach to

playing combinatorial games, which involves the evaluation of future moves

to some upper limit. In [1], AW[*] is conjectured to be the natural home of

short 2 player games.

15

Page 18: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

3 The Game of UNO

In this section we will analyze known results regarding the game of UNO.

UNO is a popular game of cards. Each card consists of two attributes, number

and color. There are also some cards with special effects. In the beginning of

the game, an equal number of cards is dealt to each of the players. Players

take turns discarding one card at a time from their hand to a middle pile of

used cards. The rule is that the discarded card should match the top card

on the pile either in color or in number. If the player who is about to play

doesn’t have a matching card to play, then she is required to draw one card

from a stack of unused cards. If the new card does not match either, then

the player loses her turn. The first player to get rid of all her cards wins.

We present results from the work by E. Demaine, M. Demaine, N. Harvey,

R. Uehara, T. Uno and Y. Uno [13]. The authors study a simplified version

of the game with no special effect cards and no stack of unused cards (if

a player doesn’t have a card to play she loses the game). However, this

inconvenience is somewhat remedied by the fact that the simplified version

is a perfect information game, where the opponents’ cards are open. Below,

we present the game definitions more formally.

An UNO card is defined by a color-number pair (x, y) ∈ X × Y , where

X = {1, 2, . . . c} is a set of colors and Y = {1, 2, . . . b} is a set of numbers.

In an UNO game there are p players participating (where p ≥ 1). At the

beginning, each player i is given a set of Ci cards. We assume that the set

C =⋃

iCi is a multi-set (i.e. two or more cards can have the same number

and color).

An interesting observation is that the problem can be expressed in a

graph-theoretic form, where the dealt cards are the vertices and two vertices

are connected with an edge if the cards that they represent can be discarded

one after the other in a game play, i.e if they share either the same color

16

Page 19: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

or the same number, and, in the many-player version, one belongs in the

hand of the i-th player and the other in the hand of the i + 1( mod p)-th

player. In that sense, the one-player version where a single player is trying

to discard all of her cards, is equivalent to finding a Hamiltonian path in

the card graph, whereas the p-player un-cooperative version is like playing

Generalized Geography on the card graph.

We present results regarding the one-player version of the game. This

problem is NP-Complete when c and b are unbounded and in XP when c

(or equivalently b) is a parameter. We also present some interesting open

problems.

3.1 Single player version of UNO

As it was mentioned before, each game instance can be expressed as an

(undirected) graph, where vertices represent the cards and two vertices are

connected if the cards that they represent share the same color or the same

number. In that sense, solving the solitaire UNO becomes equivalent to

finding a Hamiltonian Path in the graph. Let us now examine the properties

of an UNO graph.

The vertices of a single-player UNO graph represent cards that can be

determined by a pair of attributes (color,number). Thus, UNO graphs can

be redrawn in a grid-like form, where cards of the same number are on the

same line and cards of the same color are on the same column. It is easy to

see that the graph will have edges only within the same lines or the same

columns. In fact, the graph induced by a line or a column of this grid-like

UNO graph will be a clique. An UNO graph can be seen in figure 3.1 (boxes

represent cliques).

Observe that UNO graphs are claw-free graphs: there is no induced K1,3.

Furthermore, it is not difficult to see that an UNO graph is the line graph of

17

Page 20: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

Figure 3.1: A set of UNO cardsrepresented as a grid-like graph.Vertices enclosed in boxes are fullyjoint with edges.

Figure 3.2: A Hamiltonian pathin the UNO graph, which can beviewed as a discarding sequence ofthe cards.

Figure 3.3: The bipartite graph whose line graph is shown in figure 3.1.

a bipartite graph, with one part having c vertices labeled {1,2,. . . c} and the

other b vertices labeled {1,2,. . . b}, and each card is represented as an edge

connecting a color to a number. The graph of figure 3.1 is the line graph of

the graph shown in figure 3.3.

This observation, together with the fact that Hamiltonian Path is NP-

Hard in line graphs of bipartite graphs leads to the following theorem.

Theorem 3.1 (From [2]). The single player version of UNO where the num-

ber of colors c and number of numbers b is unbounded is NP-Hard.

The parameterized version of the problem where the number of colors c

18

Page 21: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

is the parameter, can be shown to be in XP, by showing that the underlying

card graph has small clique-width and solving Hamiltonian Path with

dynamic programming, see section 2.

Lemma 3.1. Single player UNO graphs have clique-width at most 2c.

Proof. An arbitrary UNO graph can be constructed line by line as follows:

• Construct the vertices of the first line and give them all different colors

among {1, 2, . . . ,c}.

• Assuming that l lines are already constructed using colors {1, 2, . . . , c}and that all vertices in a column share the same color, construct the

vertices in line l+ 1 and give them all different colors within {c+ 1, c+

2, . . . , 2c}.

• Connect vertex with color c+ i with vertex with color c+j for all i ≤ j.

• Connect vertex with color c+ i to vertices with color i.

• Rename color c+ i to i.

From Lemma 3.1 and using standard dynamic programming techniques,

we can solve the single player version of UNO in time polynomial in the size

of the input (assuming that the number of colors is a small constant).

Theorem 3.2. The single player parameterized version of UNO where c is

a parameter is in XP.

An interesting question which was posed in [13] is whether the above

parameterized problem is in FPT. Unfortunately, Hamilton cycle is known

to be W-hard for clique-width (see [18]), so this observation can’t be used

in order to provide an FPT algorithm. On the other hand, one can consider

19

Page 22: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

the equivalent problem Edge Hamiltonian Path (find a Hamilton path

on the line graph) on a bipartite graph. If the number of colors (or numbers)

is small, then this graph has a small vertex cover. The reason this fact might

be helpful is the following observation: the large part can be divided into a

small (bounded by a function of c) number of groups of vertices which are

equivalent in terms of neighborhood. This fact could be helpful in order to

provide a kernel for the problem. We are not aware of Edge Hamiltonian

Path being solvable for graphs of small vertex cover, but this might be an

interesting problem to tackle. Furthermore, the UNO graph itself has a very

interesting structure that one could possibly explore in order to provide an

FPT algorithm.

3.2 Many-player uncooperative version

As it was suggested in the introduction of this section, the uncooperative

version of UNO is equivalent to playing Generalized Geography on the

card graph. The card graph is a directed p−partite graph. However, in the

2-player case the graph is undirected since two cards u ∈ C1 and v ∈ C2 can

be discarded either in the order u, v or in the order v, u.

As it was stated in section 2, Generalized Geography is in P for

undirected graphs. As a result, 2-player uncooperative UNO is also in P. An

interesting question is the case of p ≥ 3. We conjecture that this problem is

PSPACE-Complete. Namely, one can try to provide a reduction from Edge

Generalized Geography on directed bipartite graphs, which is a known

PSPACE-Complete problem (see [20]), following similar proof ideas as the

ones that appear in [13].

Last, yet another interesting variation to consider (given that the p-player

game is indeed proven to be PSPACE-hard for p ≥ 3) is the game parame-

terized by the number of rounds played. It can be shown that it this problem

20

Page 23: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

is in XP by the trivial algorithm that creates the game DAG for all possible

paths of length up to k with k being the number of rounds (size O(nk) ) and

analyzing the outcome starting from the leaves and working all the way to

the root. It is interesting to explore whether there exists an FPT algorithm

for this problem.

4 The Game of SET

The game of SET is a card game in which players seek to form Sets of cards

from a special deck. Each card from this deck has a picture with 4 attributes

(shape, color, number, shading), and each attribute can take one of 3 values

(for example the shape can be oval, squiggle, or diamond, the color can be

blue, green, or purple, etc). To create a Set2, the player needs to identify 3

cards in which, for each attribute independently, either all cards agree on the

value, or they constitute a rainbow of all possible values. In a single round of

the normal play, 12 cards are dealt and the players seek (simultaneously) a

Set. The first player to find a Set wins the 3 cards constituting it. Then 3 new

cards are dealt in the old ones’ places and the game continues with the next

round. In the unlucky event that no Set exists among the 12 cards, players

deal 3 more from the stack. The game finishes when there are no more cards

to deal. The player acquiring the most cards wins. For more information

regarding the game and its rules as well as for other variations see the official

website of the game http://www.setgame.com/set/index.html.

The game of SET has gained remarkable attention and popularity (espe-

cially among mathematicians) as well as many awards. The game has been

the subject of both educational and technical research. A broad set of ed-

ucational activities has been suggested, a collection of which can be found

2The first letter of Set is capitalized to avoid a mix-up with the notion of mathematicalset

21

Page 24: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

in [24]. Furthermore, the game has been studied extensively from a more

technical mathematical point of view, considering questions like “what is the

maximum number of cards with n attributes and 3 values that can be laid

such that no Sets are formed” [10], or “for fixed n, how many non-isomorphic

collections of n cards are there” [5]). In [33], many other similar questions

are posed. In addition to the game’s popularity, one motivation for this in-

tense study is that the problem has a very natural alternative mathematical

formulation: if one describes the cards as four-dimensional vectors over the

set {0, 1, 2}, then a Set is exactly a collection of three collinear points, that

is, three points whose vectors add up to 0(mod3). Nevertheless, the first

and - to the best of our knowledge - only attempt to consider the game’s

computational complexity was made by Chaudhuri et al [3] in 2003, who

showed that a generalization of the game is NP-complete.

In order to study a game from the viewpoint of computational complexity

theory, one needs to define a natural generalization of the game in question

(as the original constant size game always has constant time and space com-

plexity). In a round of SET, there are 3 parameters to consider: the number

of cards m, the number of attributes n and the number of values k (in the

original game m = 12, n = 4 and k = 3). A subset of k cards will be consid-

ered to be a Set if for all attributes, values either all agree or all differ. Of

course these three parameters are not totally independent as the number of

cards m is upper-bounded by kn. In any multi-round version of the game,

an extra parameter r being the number or rounds is added.

4.1 One round of SET

Chaudhuri et al. in [3] consider a single-round version of SET. We are dealt m

cards, each with n attributes that can take one of k values and we need to find

a set of size k. We call this problem k-Value 1-Set. Their main insight is

22

Page 25: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

Figure 4.1: An example of an n−dimensional perfect matching and of a Setof cards with n attributes and k values each.

that this problem can be seen as a hypergraph problem. Specifically, one may

construct a hypergraph on n ·k vertices, each representing an attribute-value

pair. Now, cards can be represented as hyperedges, by including in each

hyperedge the k values that describe the corresponding card’s attributes.

See figure 4.1. It is not hard to see that a perfect matching in this n-partite

hypergraph corresponds to a Set in the original instance. On the other hand,

some Sets do not correspond to perfect matchings, because all cards may

share the same value for some attributes. Nevertheless, Chaudhuri et al.

have established that the two problems have the same complexity and finding

a Set is essentially algorithmically equivalent to find a perfect matching in

this hypergraph.

Theorem 4.1. Perfect Multi-Dimensional Matching is polynomially

reducible to k-Value 1-Set.

Proof. Given an instance of Perfect Multi-Dimensional Matching

namely an n−partite graph G(V1 ∪ V2 ∪ . . . ∪ Vn, E) with each part of equal

size k, we construct an n−partite graph G′(V ′1 ∪ V ′

2 ∪ . . .∪ V ′n, E

′) as follows:

we add a k + 1−th value (vertex) vik+1in each set Vi to create V ′

i . Also

E ′ = E ∪ e′, where e′ = {v1k+1, v2k+1

, . . . , vnk+1} is a multiedge that spans

through the newly added vertices vik+1.

Now, if G has a perfect multidimensional matching M then G′ also has

a multidimensional matching M ′ = M ∪ e. Since M ′ is a multidimensional

23

Page 26: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

matching, it is also a Set in G′. On the other hand, if G′ has a Set M ′, then

this has to be a multidimensional matching since no other multiedge apart

from e′ goes through the vertices vik+1. So M ′ \ e′ should be a multidimen-

sional perfect matching in G.

In what follows we will exploit this connection between k-Value 1-Set

and Perfect Multi-Dimensional Matching to analyze the complexity

of finding a Set with respect to the three relevant parameters m,n, and k. If

k is unbounded, Theorem 4.1 implies that k-Value 1-Set is NP-hard even

for just 3 attributes. If the cards have only 2 attributes, the game is in P

as this problem is equivalent with finding a perfect matching or a star in a

bipartite graph. On the other hand, if n is unbounded but the number of

values k is considered as a parameter, the problem is in XP (by the trivial

algorithm that enumerates all size-k sets of cards and checking whether any

of them constitutes a Set). An interesting open question is whether the triv-

ial algorithm can be improved to an FPT algorithm. In [27], this question

was answered negatively, by proving that the problem is W[1]-hard. This

W-hardness proof applies to Perfect Multi-Dimensional Matching

as well, proving that Perfect Multi-Dimensional Matching parame-

terized by the size of the dimensions k (while the number of dimensions n is

unbounded) is W[1]-hard. This result may be of independent interest, as this

is a natural parameterization of a classic problem that has not been consid-

ered before. The only relevant parameterized result known is that Maximum

Multi-Dimensional Matching parameterized by the size of the matching

and the number of dimensions is FPT (first established in [14] and further

improved in [4].

24

Page 27: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

4.2 Multi-round versions

In order to study the game from a more realistic point of view, it is necessary

to study multi-round variations. The game is already NP-Complete for one

round for n ≥ 3. On the other hand, if k = 2 and n is unbounded, the answer

is trivial as any two cards form a Set. So it makes sence to focus our attention

to the case where the number of values k is 3 and n is unbounded (k = 3

is also interesting, since this is the value of the parameter k in the actual

game). We remind the reader that there is a polynomial time algorithm to

find whether there exists at least one Set, in other words to play just one

round. The complexity stays the same even if we consider the question of

enumerating all Sets. This generalizes the daily puzzles found either on the

official website of SET or in the New York Times. In these puzzles we are

given m cards and need to find the maximum number of Sets assuming that

we don’t remove any cards from the table after finding a Set.

It becomes interesting to ask the same question for a multi-round game,

where cards are gradually removed. This corresponds to the CO-OP version

of the game, where players have to cooperate in order to find the maximum

number of available Sets given that cards of found Sets are removed from

the table (see rules for CO-OP SET for the rules of this variation). We

call this variation Max 3-Value r-Set. Another interesting variation is

the corresponding minimization version, where we are looking for the mini-

mum number of Sets that once picked destroy all existing Sets. We call this

variation Min 3-Value r-Set. Both problems can be seen as special cases

of more general packing and covering problems. In the maximization ver-

sion, one is looking for a maximum 3-set packing, while in the minimization

version one is looking for a minimum independent edge dominating set (or

equivalently a Minimum Maximal Matching) in a 3-uniform hypergraph.

It is interesting to examine whether these problems remain NP-Hard even

on instances that correspond to the SET game. This question is answered

25

Page 28: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

positively in [27]. For the latter problem, it is easy to show a reduction from

Independent Edge Dominating Set on graphs.

Theorem 4.2. Min 3-Value r-Set is polynomially reducible to Indepen-

dent Edge Dominating Set.

Proof. Given an instance of Independent Edge Dominating Set (a

graph G(V,E) and a number r), we create an instance of Min 3-Value

r-Set of |V | + |E| cards with |V | dimensions each, such that if G has an

edge dominating set of size at most r then there exist at most r Sets which

once picked up destroy all other Sets. Cards will be represented by vectors

in F|V |3 .

The construction is as follows: For each vertex i ∈ V we create a card

where all coordinates are 0 except from the value of the ith coordinate which

is equal to 1. Furthermore, for each edge (i, j) ∈ E we create a card where

all coordinates are 0 except from the values of coordinates i and j which are

equal to 2.

Observe that the only Sets formed correspond directly to edges in G.

Picking a Set corresponding to edge (i, j) eliminates the cards corresponding

to vertices i, j (together with the card corresponding to edge (i, j)). This

move causes the elimination of any potential Set containing cards correspond-

ing to vertices i and j. Thus an edge dominating set of size at most r in G

corresponds to an equal number of Sets overlapping all other Sets. On the

other hand the smallest number of Sets that overlap all other Sets is equal

to the minimum edge dominating set.

From the parameterized point of view, if one considers as the parameter

the number of rounds played r, natural parameterizations of the two problems

are to ask whether there exist at least r mutually disjoint Sets, or whether

there exist at most r Sets to destroy all Sets. The former is shown to be

26

Page 29: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

Fixed Parameter Tractable by Chen et al. [4]. The latter is an interesting

open question, and it is tackled in [27] through the close connection with

Independent Edge Dominating Set on graphs that was presented.

4.3 A two-player game

In this section, we analyse a potentially interesting two-player game which

we call 2P 3-Value Set. Suppose that an arbitrary set of cards is on the

table and two opposing players take turns playing. Each player may select

three cards that form a Set and remove them from play. No additional cards

are dealt. The game goes on until a player is unable to find a Set, in which

case she loses.

Unlike the solitaire games Max 3-Value r-Set and Min 3-Value r-

Set, here players must exercise some strategic thinking: each player is trying

not only to maximize the number of Sets she will collect but also to prevent

the opponent from forming a set.

This game can be seen as a restriction of the game Arc Kayles in 3-

uniform hypergraphs (where hyperedges should be valid Sets). Arc Kayles

is defined below.

Definition 4.1. Problem: Arc Kayles.

Input: A (hyper-)graph G(V,E).

Description: Players take turns picking edges from G. When an edge e is

picked, e together with all incident vertices to e are removed. First player

unable to pick an edge loses.

Question: Is there a winning strategy for player A?

The complexity of Arc Kayles is currently unknown even on graphs and

it has been a long-standing open question since the PSPACE-Completeness

of its sibling problem Node Kayles was established in [30]. The multi-

round 2-player version of SET is at least as hard as Arc Kayles, following

27

Page 30: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

the reduction of Min 3-Value r-Set to Independent Edge Dominat-

ing Set. A slightly more general version of Arc Kayles is mentioned

to be PSPACE-complete in [30], while the natural generalization of Arc

Kayles to hypergraphs with unbounded hyperedge size is PSPACE-hard by

the complexity of poset games [23].

The 2-player SET problem on graphs is a natural restriction of Arc

Kayles, though this version of SET, unlike its hypergraph counterpart turns

out to be trivial: if the size of the Sets (i.e. the number of different values)

is 2 then any 2 cards form a Set; thus the 2-player problem is equivalent to

Arc Kayles on complete graphs and becomes a simple matter of parity of

the number of nodes.

A possible direction is to study 2P 3-Value Set from a parameterized

point of view. An interesting question is whether player 1 has a winning

strategy in r moves. In [1] it was established that the r-move parameterized

version of Node Kayles is AW[*]-hard. This question is addressed in [27],

where we prove that the problem is FPT. Settling that 2-player SET is FPT

parameterized by r implies the same result for Arc Kayles on graphs.

28

Page 31: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

References

[1] Karl R. Abrahamson, Rodney G. Downey, and Michael R. Fellows.Fixed-parameter tractability and completeness iv: On completeness forw[p] and pspace analogues. Ann. Pure Appl. Logic, 73(3):235–276, 1995.

[2] Alan A Bertossi. The edge Hamiltonian path problem is NP-complete.Information Processing Letters, 13(4):157–159, 1981.

[3] K. Chaudhuri, B. Godfrey, D. Ratajczak, and H. Wee. On the complex-ity of the game of Set. Manuscript, 2003.

[4] Jianer Chen, Qilong Feng, Yang Liu, Songjian Lu, and Jianxin Wang.Improved deterministic algorithms for weighted matching and packingproblems. Theor. Comput. Sci., 412(23):2503–2512, 2011.

[5] Ben Coleman and Kevin Hartshorn. Game, set, math. MathematicsMagazine, 85(2):83–96, 2012.

[6] S.A. Cook. The complexity of theorem-proving procedures. In Proceed-ings of the third annual ACM symposium on Theory of computing, pages151–158. ACM, 1971.

[7] Derek G Corneil and Udi Rotics. On the relationship between clique-width and treewidth. SIAM Journal on Computing, 34(4):825–847, 2005.

[8] Bruno Courcelle. The monadic second-order logic of graphs. I. Recog-nizable sets of finite graphs. Information and computation, 85(1):12–75,1990.

[9] Bruno Courcelle, Johann A Makowsky, and Udi Rotics. Linear time solv-able optimization problems on graphs of bounded clique-width. Theoryof Computing Systems, 33(2):125–150, 2000.

[10] Benjamin Lent Davis, Davis, and Diane Maclagan. The card game set,2003.

[11] E. Demaine, S. Hohenberger, and D. Liben-Nowell. Tetris is hard, evento approximate. Computing and Combinatorics, pages 351–363, 2003.

29

Page 32: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

[12] Erik D Demaine, Martin L Demaine, Nicholas J. A Harvey, RyuheiUehara, Takeaki Uno, and Yushi Uno. UNO is hard, even for a singleplayer. Manuscript, 2013.

[13] Erik D Demaine, Martin L Demaine, Ryuhei Uehara, Takeaki Uno, andYushi Uno. UNO is hard, even for a single player. In Fun with Algo-rithms, pages 133–144. Springer, 2010.

[14] Rodney G. Downey and Michael R. Fellows. Parameterized Complexity.Springer-Verlag, 1999. 530 pp.

[15] Wolfgang Espelage, Frank Gurski, and Egon Wanke. How to solve NP-hard graph problems on clique-width bounded graphs in polynomialtime. In Graph-theoretic concepts in computer science, pages 117–128.Springer, 2001.

[16] Michael R. Fellows, Danny Hermelin, Frances A. Rosamond, andStephane Vialette. On the parameterized complexity of multiple-intervalgraph problems. Theor. Comput. Sci., 410(1):53–61, 2009.

[17] Michael R Fellows, Frances A Rosamond, Udi Rotics, and Stefan Szeider.Clique-width minimization is NP-hard. In Proceedings of the thirty-eighth annual ACM symposium on Theory of computing, pages 354–362.ACM, 2006.

[18] Fedor V Fomin, Petr A Golovach, Daniel Lokshtanov, and SaketSaurabh. Clique-width: on the price of generality. In Proceedings ofthe twentieth Annual ACM-SIAM Symposium on Discrete Algorithms,pages 825–834. Society for Industrial and Applied Mathematics, 2009.

[19] A.S. Fraenkel and D. Lichtenstein. Computing a perfect strategy forn × n chess requires time exponential in n. Journal of CombinatorialTheory, Series A, 31(2):199–214, 1981.

[20] Aviezri S Fraenkel, Edward R Scheinerman, and Daniel Ullman. Undi-rected edge geography. Theoretical Computer Science, 112(2):371–381,1993.

[21] Michael R Garey and David S Johnson. Computers and Intractability,volume 174. freeman New York, 1979.

30

Page 33: The Computational Complexity of Games and Puzzles...time mathematical and algorithmic depth, they serve as a great teaching tool. For example, Prisner in university of Maryland used

[22] John Goldwasser and William Klostermeyer. Maximization versions of”lights out” games in grids and graphs. Congressus Numerantium, pages99–112, 1997.

[23] Daniel Grier. Deciding the winner of an arbitrary finite poset gameis pspace-complete. In Fedor V. Fomin, Rusins Freivalds, Marta Z.Kwiatkowska, and David Peleg, editors, ICALP (1), volume 7965 ofLecture Notes in Computer Science, pages 497–503. Springer, 2013.

[24] Set Enterprises Inc., editor. Mathematics Workbook: How to Use theSET Game in the Classroom. Set Enterprises, Inc., 2011.

[25] S. Iwata and T. Kasai. The Othello game on an n × n board is PSPACE-complete. Theoretical Computer Science, 123(2):329–340, 1994.

[26] R.M. Karp. Reducibility among combinatorial problems. In Proceedingsof Symposium on the Complexity of Computer Computations, pages 85–103. The IBM Research Symposia Series, Plenum Press, 1972.

[27] Michael Lampis and Valia Mitsou. The computational complexityof the game of set and its theoretical applications. arXiv preprintarXiv:1309.6504, 2013.

[28] D. Lichtenstein and M. Sipser. Go is polynomial-space hard. Journal ofthe ACM (JACM), 27(2):393–401, 1980.

[29] Christos M. Papadimitriou. Computational complexity. Addison-Wesley,Reading, Massachusetts, 1994.

[30] Thomas J. Schaefer. On the complexity of some two-person perfect-information games. J. Comput. Syst. Sci., 16(2):185–225, 1978.

[31] J. Stuckman and G.Q. Zhang. Mastermind is NP-complete. Arxivpreprint cs/0512049, 2005.

[32] Y. Takayuki. Complexity and completeness of finding another solutionand its application to puzzles. Master’s thesis, Citeseer, 2003.

[33] Mike Zabrocki. The joy of set, 2001.

31