Taking and Breaking Games Student: Bc
Total Page:16
File Type:pdf, Size:1020Kb
ASSIGNMENT OF MASTER’S THESIS Title: Taking and Breaking Games Student: Bc. Šimon Lomič Supervisor: RNDr. Tomáš Valla, Ph.D. Study Programme: Informatics Study Branch: System Programming Department: Department of Theoretical Computer Science Validity: Until the end of winter semester 2020/21 Instructions Combinatorial games is a class of finite two-player games with full information and no chance. Taking and breaking games are a subclass of combinatorial games involving heaps of tokens, where players alternately choose a heap, remove some tokens and split the remaining heap into several other heaps, according to given particular rules. The goals of this thesis are: 1) To survey existing results in the field. 2) Try to attack several open problems in solving Subtraction games, Octal and Hexadecimal games, and others. 3) Perform experimental evaluation of various game solving algorithms. The thesis emphasises theoretical research aspects of the field. References Will be provided by the supervisor. doc. Ing. Jan Janoušek, Ph.D. doc. RNDr. Ing. Marcel Jiřina, Ph.D. Head of Department Dean Prague February 19, 2019 Master’s thesis Taking and Breaking Games Bc. Šimon Lomič Department of Theoretical Computer Science Supervisor: RNDr. Tomáš Valla, Ph.D September 8, 2019 Acknowledgements First and foremost, I would like to thank my supervisor Tomáš Valla for introducing me into this fascinating topic and for many invaluable insights. Second, I thank my family for supporting me during my studies. Third, I am grateful to my friends and coworkers for listening, offering me advice, and supporting me through this entire process. And last but not least, I want to thank my beloved Patricia for everything she does for me. Declaration I hereby declare that the presented thesis is my own work and that I have cited all sources of information in accordance with the Guideline for adhering to ethical principles when elaborating an academic final thesis. I acknowledge that my thesis is subject to the rights and obligations stipu- lated by the Act No. 121/2000 Coll., the Copyright Act, as amended. In accor- dance with Article 46(6) of the Act, I hereby grant a nonexclusive authoriza- tion (license) to utilize this thesis, including any and all computer programs incorporated therein or attached thereto and all corresponding documentation (hereinafter collectively referred to as the “Work”), to any and all persons that wish to utilize the Work. Such persons are entitled to use the Work in any way (including for-profit purposes) that does not detract from its value. This authorization is not limited in terms of time, location and quantity. In Prague on September 8, 2019 . .. .. .. .. .. .. Czech Technical University in Prague Faculty of Information Technology © 2019 Šimon Lomič. All rights reserved. This thesis is school work as defined by Copyright Act of the Czech Republic. It has been submitted at Czech Technical University in Prague, Faculty of Information Technology. The thesis is protected by the Copyright Act and its usage without author’s permission is prohibited (with exceptions defined by the Copyright Act). Citation of this thesis Lomič, Šimon. Taking and Breaking Games. Master’s thesis. Czech Technical University in Prague, Faculty of Information Technology, 2019. Abstrakt V této práci analyzujeme několik otevřených problémů v oblasti nestran- ných i stranných her typu Taking and Breaking. Pro nestranné odčítací hry dokážeme existenci hry s aperiodickou nim-sekvencí a periodickou sekvencí výhra-prohra. Analyzujeme ekvivalenční třídy těchto her a nalézáme řešení jedné z těchto tříd. Také představujeme novou hru typu Taking and Break- ing, kterou z velké části vyřešíme. V oblasti stranných her provedeme analýzu několika odčítacích her a her typu Pure Breaking. Pro tyto hry také před- stavíme obecnou techniku testování aritmetické periodicity. Pro automatické řešení nestranných her typu Taking and Breaking navrhujeme několik algo- ritmů. Práci uzavíráme důkazem PSPACE-těžkosti nestranné zobecněné odčí- tací hry a EXPTIME-těžkosti této hry ve stranné variantě. Klíčová slova kombinatorická teorie her, hry typu Taking and Breaking, Sprague-Grundyho teorie, nestranné hry, stranné hry, odčítací hry, nim-hodnoty vii Abstract In this thesis, we examine several open problems in taking and breaking games under the impartial and partizan setting. We prove the existence of an impartial subtraction game with aperiodic nim-sequence and periodic out- come sequence. We also analyze the equivalence classes of subtraction games and provide a solution to one of these classes. We introduce a new taking and breaking game and partially solve it. Then we solve several partizan subtraction games and partizan pure breaking games and describe a general technique for testing arithmetic periodicity of these games. Moreover, we de- sign some game solving algorithms for impartial taking and breaking games. We prove PSPACE-hardness for a generalized subtraction game under the impartial setting and EXPTIME-hardness under the partizan setting. Keywords combinatorial game theory, taking and breaking games, Sprague- Grundy theory, impartial games, partizan games, subtraction games, nimbers viii Contents Introduction 1 1 Preliminaries 5 2 Combinatorial Game Theory 11 2.1 Disjunctive Theory ......................... 16 2.2 Canonical Theory .......................... 18 2.3 Impartial Theory .......................... 34 2.4 Algorithmic Combinatorial Game Theory . 39 3 Taking and Breaking Games 47 3.1 Heap Games ............................ 47 3.2 Taking and Breaking Games .................... 53 3.3 Subtraction Games ......................... 56 3.4 Octal and Hexadecimal Games . 73 3.5 Hexadecimal games ......................... 79 3.6 Pure Breaking Games ....................... 82 3.7 Partizan Code-Digit Games .................... 83 4 Our Results 89 4.1 Results on Subtraction Games . 90 4.2 Results on Code-Digit Games . 105 4.3 Results on Partizan Games . 108 4.4 Algorithmic and Complexity Results . 126 Conclusion and Future Work 147 A Contents of Enclosed Media 151 Bibliography 153 ix List of Figures 2.1 Position in the game of Domineering. 12 2.2 Game tree of a Domineering position. 13 2.3 Some simplest games and their game trees. 20 2.4 A Hasse diagram of the partial ordering of the outcome classes. 22 2.5 Dominated moves. ........................... 24 2.6 Reversible moves. ............................ 24 2.7 An evolutionary tree of dyadic games born by day 3. 29 2.8 Game trees of some infinitesimals and dyadic numbers. 32 2.9 Ruleset of Nim. ............................. 35 3.1 Ruleset of Heap Games. ....................... 48 3.2 Ruleset of a Nimania. ......................... 48 3.3 Ruleset of Grundy’s Game. ..................... 53 3.4 Ruleset of a game Wythoff. ..................... 71 4.1 Canonical form sequence of Sp1, 2 | 1, 3q. 113 4.2 Canonical form sequence of PBp1 | 3q. 118 4.3 Canonical form sequence of PBp1 | 1, 2q. 120 4.4 Case analysis for the game PBp1 | 2, 3q. 122 4.5 Canonical sequence of chessboard subtraction game Sp1, 2q. 125 4.6 The nim-sequence of PBp1, 2q. 135 4.7 Graph of properties of masters of subtraction games based on their maximal number. ............................141 xi List of Tables 2.1 The outcome of a sum of two games based on their outcome under Normal play. .............................. 17 3.1 Known results on the aperiodic subtraction games. 71 3.2 Non-trivial octal games with known structure [20]. 78 3.3 Solution for particular pure breaking games introduced in [11]. 83 4.1 The nim-sequence of the game Sp1, 4, 10q. 91 4.2 Combinations of game rcf -values for PBp1 | 2, 3q . 122 4.3 Computational results on integer arithmetic periodicity of pure breaking games. ............................124 4.4 Exceptional values in the nim-sequence of PBp1, 2q. 136 4.5 Aggregated statistics for subtraction games. 140 4.6 Statistics on subclasses of subtraction games. 141 4.7 Maximal properties of masters of subtraction games based on their maximal number. ............................142 xiii List of used symbols N Set of all positive integers (natural numbers). N0 Set of all non-negative integers. ra, bq Interval starting at a (inclusive), ending at b (exclusive). txu Floor of x, the maximal integer ¤ x. rxs Ceiling of x, the least integer ¥ x. |x|y x mod y. x ` y Bitwise sum of integers, also called a nim-sum. Opnq The standard “Big O” notation that describes the limiting be- havior of functions. mex pSq The minimal excluded value in S. Σ An alphabet (any finite set). Σ˚ Set of all words in an alphabet Σ. ( gL|gR the game; gL and gR are sets options of Left and Right player. L R G ,G A typical option of Left (Right) player( in the game G. G ` H :“ GL ` H, G ` HL|GR ` H, G ` hR , a sum of games. G1 P GG1 is an option of the impartial game G. n ¨ G A scalar multiple of the game. G H Game G is incomparable with the game H. G H Game G is greater or incomparable with the game H. G H Game G is less than or incomparable with the game H. L, R, P, N Sets of left, right, lost and won games, respectively. ΦpGq A value of the game based on the game mapping function Φ. bpGq Birthday of the game G. GpGq Grundy value of an impartial game G. CpGq Canonical form of the game G. rcf pGq Reduced canonical form of the game G. opGq Outcome of the game G. G A group of all game values. Gn A group of game values born by the day n. xv Some simplest games are denoted by the following standard notation: 0 :“ t|u ∗ :“ t0|0u 1 :“ t0|u ↑ :“ t0|∗u ↓ :“ t∗|0u ´1 :“ t|0u ↑ ∗ ↑ ∗ ↑ ↑ 1 ∗ n :“ n ¨ ` n :“ n ¨ 2 :“ t0| u ⇑ ↑ ↑ ⇓ ↓ ↑ 3 :“ ` :“ ` 2 :“ t1|2u ↑r2s :“ t↑|∗u ↓r2s :“ t∗|↑u ∗n :“ t∗0, ∗1,..., ∗pn ´ 1qu The following table summarizes our naming conventions for various mathe- matical and game entities: Font Example Represents Lowercase Italic first, even,..