The Computational Complexity of Some Games and Puzzles with Theoretical Applications
Total Page:16
File Type:pdf, Size:1020Kb
THE COMPUTATIONAL COMPLEXITY OF SOME GAMES AND PUZZLES WITH THEORETICAL APPLICATIONS by Vasiliki - Despoina Mitsou A dissertation submitted to the Graduate Faculty in Computer Science in partial fulfillment of the requirements for the degree of Doctor of Philosophy, The City University of New York 2014 This manuscript has been read and accepted for the Graduate Faculty in Computer Science in satisfaction of the dissertation requirements for the degree of Doctor of Philosophy. Amotz Bar-Noy Date Chair of Examining Committee Robert Haralick Date Executive Officer Matthew Johnson Noson Yanofsky Christina Zamfirescu Kazuhisa Makino Efstathios Zachos Supervisory Committee THE CITY UNIVERSITY OF NEW YORK ii abstract The Computational Complexity of Some Games and Puzzles with Theoretical Applications by Vasiliki Despoina Mitsou Adviser: Amotz Bar-Noy The subject of this thesis is the algorithmic properties of one- and two-player games people enjoy playing, such as Sudoku or Chess. Questions asked about puzzles and games in this context are of the following type: can we design efficient computer programs that play optimally given any opponent (for a two-player game), or solve any instance of the puzzle in question? We examine four games and puzzles and show algorithmic as well as intractability results. First, we study the wolf-goat-cabbage puzzle, where a man wants to transport a wolf, a goat, and a cabbage across a river by using a boat that can carry only one item at a time, making sure that no incompatible items are left alone together. We study generalizations of this puzzle, showing a close connection with the Vertex Cover problem that implies NP-hardness as well as inapproximability results. Second, we study the SET game, a card game where the objective is to form sets of cards that match in a certain sense using cards from a special deck. We study single- and multi-round variations of this game and establish interesting con- nections with other classical computational problems, such as Perfect Multi- Dimensional Matching, Set Packing, Independent Edge Dominating Set, and Arc Kayles. We prove algorithmic and hardness results in the classical and the parameterized sense. iii Third, we study the UNO game, a game of colored numbered cards where players take turns discarding cards that match either in color or in number. We extend results by Demaine et. al. (2010 and 2014) that connected one- and two-player generaliza- tions of the game to Edge Hamiltonian Path and Generalized Geography, proving that a solitaire version parameterized by the number of colors is fixed param- eter tractable and that a k-player generalization for k ≥ 3 is PSPACE-hard. Finally, we study the Scrabble game, a word game where players are trying to form words in a crossword fashion by placing letter tiles on a grid board. We prove that a generalized version of Scrabble is PSPACE-hard, answering a question posed by Demaine and Hearn in 2008. iv Acknowledgments First of all, I would like to thank my advisor Amotz Bar-Noy for being such a great mentor! His guidance, advice, and constant encouragement (in moments where this was most needed) were essential for the completion of this thesis. I would also like to thank all my other committee members from CUNY: Noson Yanofsky for his continuous support and friendship throughout my studentship at CUNY, Stathis Zachos for convincing me to pursue a PhD at CUNY in the first place, Christina Zamfirescu for agreeing to serve in my committee during her Sabbatical, and Matt Johnson for being a good friend and colleague. I am most indebted to my outside committee member, Kaz Makino. His help and support during my last year, which I spent in Kyoto as his visitor, was immeasurable! In the list of mentors I would like to add four more people. I would like to thank Euripides Markou for introducing me to research and convincing me to work on algorithms while I was an undergrad in Athens. I am grateful to Abbe Mowshowitz for his support and guidance during my first years at CUNY. It is painful to talk about Gary Bloom; his loss was a great shock for me and the void he left difficult to fill. Our work together was a pleasure and inspiration, I will always treasure the year that I spent under his guidance. Last but not least, I would like to thank Delaram Kahrobaei for being for me a role-model of a successful woman in academia. I would like to thank all my co-authors: Antonis Achilleos, Amotz Bar-Noy, Gra- ham Bent, Panagiotis Cheilaris, Gregory Gutin, Georgia Kaouri, Eun-Jung Kim, Michael Lampis, Kaz Makino, Abbe Mowshowitz, Karolina Soltys, Yushi Uno, and Stathis Zachos. Our collaboration taught me alot and was a pleasure! I would like to acknowledge the strength of my family to let me go despite the pain my parting caused them, and thank them for always supporting my goals and for being proud of me. I was also lucky to have good friends surrounding me, who made this long journey very enjoyable. In particular, I would like to thank Antonis v Achilleos for his invaluable friendship and for being there for me during times that I most needed him! I would also like to thank Lina Garcia for being the most wonderful APO a program can have! Needless to say that the completion of this thesis would have been impossible without the financial support of different people and organizations: I gratefully ac- knowledge Abbe Mowshowitz for providing financial support through his grant dur- ing my first two years, the Bakalas foundation for supporting me financially for three years, Kaz Makino for the stipend and travel support he provided during my last year, and CUNY for providing several means of support throughout my studentship. Above all, no words can express my gratitude to the most important person in my life for being my best friend, colleague, mentor, partner, and for supporting me beyond measure towards completing my PhD, even during those times where this seemed impossible! Michael, this work is entirely dedicated to you and I hope we will always stay together in academia and in life! vi Contents 1 Introduction 1 1.1 Motivation . 1 1.2 Computational complexity background . 3 1.2.1 Complexity classes for games and puzzles . 5 1.3 Contributions . 9 2 Wolf-Goat-Cabbage puzzle 11 2.1 Introduction . 11 2.2 Definitions { Preliminaries . 16 2.3 The Unconstrained Ferry Cover problem . 18 2.3.1 Unconstrained Ferry Cover on general graphs . 18 2.3.2 Unconstrained Ferry Cover on specific graph topologies 21 2.3.3 NP certificate for Unconstrained Ferry Cover . 23 2.4 The Trip-Constrained Ferry Cover problem . 25 2.4.1 Results for general Trip-Constrained Ferry Cover . 25 2.4.2 Results for Trip-Constrained Ferry Cover when m = 1 27 2.5 Conclusions and further work . 36 3 Set game 38 3.1 Introduction . 38 3.2 Definitions . 43 vii 3.3 One round of SET . 45 3.4 Multi-round variations of SET . 50 3.4.1 NP-Hardness of the maximization version . 51 3.4.2 Results on the minimization version . 56 3.5 A two player game . 58 3.6 Conclusions and open problems . 63 4 Uno game 65 4.1 Introduction . 65 4.2 Definitions . 68 4.3 The Solitaire UNO problem . 70 4.4 The Multiplayer UNO problem . 81 4.5 Conclusions and open questions . 86 5 Scrabble game 89 5.1 Introduction . 89 5.2 Our model of Scrabble - Definitions . 91 5.3 Hardness due to placement of the words . 94 5.4 Hardness due to formation of the words . 101 5.4.1 Construction sketch . 102 5.4.2 The initial position . 103 5.4.3 Assignment phase . 105 5.4.4 Satisfaction phase . 107 5.4.5 Constant rack and word size . 109 5.5 Conclusions and open questions . 111 6 Epilogue 112 Bibliography 114 viii List of Figures 2.1 Incompatibilities of items in the classical puzzle represented as a graph. 12 2.2 An example of the graph described in Example 2.9 . 22 2.3 Similarities observed between Lemma 2.10 and Theorem 2.4. 24 2.4 The optimal value of FCm as a function of the trip-constraint m. 26 2.5 Complexity results for FCm as a function of the trip-constraint m. 27 2.6 Graph F1 of Lemma 2.18. 27 3.1 A typical instance of SET, constituting of 12 cards. 39 3.2 An example of an n−dimensional perfect matching and of a Set of cards with n attributes and k values each. 46 0 3.3 The vertex-hyperedge of G that corresponds to vertex v13 of part V1 in G..................................... 48 0 3.4 The edge-hyperedge of G that corresponds to the edge eij connecting parts Vi and Vj of G............................ 48 3.5 A partial matching corresponding to a selection of an edge and its two incident vertices. 48 3.6 A complete example for W-hardness of Section 3.3. 49 3.7 The 3-uniform hypergraph construction from a typical instance of SET. 51 3.8 The variable gadget. 53 3.9 The clause gadget. 53 ix 3.10 An example of the construction of the r-partite graph G0 from hyper- graph G for r =3. ............................ 61 4.1 An UNO graph. 71 4.2 The attribute (bipartite) graph whose line graph is shown in figure 4.1a. 72 4.3 Reduction from 2-player to p-player Edge Generalized Geography. 84 4.4 An edge played in Generalized Geography corresponds to a round of UNO..................................