Faster Evaluation of Subtraction Games

D. Eppstein
{"title":"Faster Evaluation of Subtraction Games","authors":"D. Eppstein","doi":"10.4230/LIPIcs.FUN.2018.20","DOIUrl":null,"url":null,"abstract":"Subtraction games are played with one or more heaps of tokens, with players taking turns removing from a single heap a number of tokens belonging to a specified subtraction set; the last player to move wins. We describe how to compute the set of winning heap sizes in single-heap subtraction games (for an input consisting of the subtraction set and maximum heap size $n$), in time $\\tilde O(n)$, where the $\\tilde O$ elides logarithmic factors. For multi-heap games, the optimal game play is determined by the nim-value of each heap; we describe how to compute the nim-values of all heaps of size up to~$n$ in time $\\tilde O(mn)$, where $m$ is the maximum nim-value occurring among these heap sizes. These time bounds improve naive dynamic programming algorithms with time $O(n|S|)$, because $m\\le|S|$ for all such games. We apply these results to the game of subtract-a-square, whose set of winning positions is a maximal square-difference-free set of a type studied in number theory in connection with the Furstenberg-Sarkozy theorem. We provide experimental evidence that, for this game, the set of winning positions has a density comparable to that of the densest known square-difference-free sets, and has a modular structure related to the known constructions for these dense sets. Additionally, this game's nim-values are (experimentally) significantly smaller than the size of its subtraction set, implying that our algorithm achieves a polynomial speedup over dynamic programming.","PeriodicalId":293763,"journal":{"name":"Fun with Algorithms","volume":"15 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2018-04-18","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Fun with Algorithms","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.4230/LIPIcs.FUN.2018.20","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1

Abstract

Subtraction games are played with one or more heaps of tokens, with players taking turns removing from a single heap a number of tokens belonging to a specified subtraction set; the last player to move wins. We describe how to compute the set of winning heap sizes in single-heap subtraction games (for an input consisting of the subtraction set and maximum heap size $n$), in time $\tilde O(n)$, where the $\tilde O$ elides logarithmic factors. For multi-heap games, the optimal game play is determined by the nim-value of each heap; we describe how to compute the nim-values of all heaps of size up to~$n$ in time $\tilde O(mn)$, where $m$ is the maximum nim-value occurring among these heap sizes. These time bounds improve naive dynamic programming algorithms with time $O(n|S|)$, because $m\le|S|$ for all such games. We apply these results to the game of subtract-a-square, whose set of winning positions is a maximal square-difference-free set of a type studied in number theory in connection with the Furstenberg-Sarkozy theorem. We provide experimental evidence that, for this game, the set of winning positions has a density comparable to that of the densest known square-difference-free sets, and has a modular structure related to the known constructions for these dense sets. Additionally, this game's nim-values are (experimentally) significantly smaller than the size of its subtraction set, implying that our algorithm achieves a polynomial speedup over dynamic programming.
快速评估减法游戏
减法游戏是用一堆或多堆代币玩的,玩家轮流从一堆属于指定减法集的代币中移除若干代币;最后移动的玩家获胜。我们描述了如何在单堆减法游戏中计算获胜的堆大小集(对于由减法集和最大堆大小$n$组成的输入),时间为$\tilde O(n)$,其中$\tilde O$省略了对数因素。对于多堆游戏,最优游戏玩法由每个堆的最小值决定;我们描述了如何在$\tilde O(mn)$时间内计算所有大小为$n$的堆的nimm值,其中$m$是这些堆大小中出现的最大nimm值。这些时间界限改进了时间$O(n|S|)$的朴素动态规划算法,因为$m\le|S|$适用于所有此类游戏。我们将这些结果应用于减a方博弈,其获胜位置集是数论中与Furstenberg-Sarkozy定理相关的一种类型的最大方无差集。我们提供的实验证据表明,对于这个游戏,获胜位置的集合具有与已知最密集的平方无差分集相当的密度,并且具有与这些密集集的已知构造相关的模块化结构。此外,这款游戏的nimo值(实验上)明显小于其减法集的大小,这意味着我们的算法比动态规划实现了多项式加速。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信