{"title":"Making Change in 2048","authors":"D. Eppstein","doi":"10.4230/LIPIcs.FUN.2018.21","DOIUrl":"https://doi.org/10.4230/LIPIcs.FUN.2018.21","url":null,"abstract":"The 2048 game involves tiles labeled with powers of two that can be merged to form bigger powers of two; variants of the same puzzle involve similar merges of other tile values. We analyze the maximum score achievable in these games by proving a min-max theorem equating this maximum score (in an abstract generalized variation of 2048 that allows all the moves of the original game) with the minimum value that causes a greedy change-making algorithm to use a given number of coins. A widely-followed strategy in 2048 maintains tiles that represent the move number in binary notation, and a similar strategy in the Fibonacci number variant of the game (987) maintains the Zeckendorf representation of the move number as a sum of the fewest possible Fibonacci numbers; our analysis shows that the ability to follow these strategies is intimately connected with the fact that greedy change-making is optimal for binary and Fibonacci coinage. For variants of 2048 using tile values for which greedy change-making is suboptimal, it is the greedy strategy, not the optimal representation as sums of tile values, that controls the length of the game. In particular, the game will always terminate whenever the sequence of allowable tile values has arbitrarily large gaps between consecutive values.","PeriodicalId":293763,"journal":{"name":"Fun with Algorithms","volume":"11 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2018-04-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"130161431","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Computational Complexity of Generalized Push Fight","authors":"Jeffrey Bosboom, E. Demaine, Mikhail Rudoy","doi":"10.4230/LIPIcs.FUN.2018.11","DOIUrl":"https://doi.org/10.4230/LIPIcs.FUN.2018.11","url":null,"abstract":"We analyze the computational complexity of optimally playing the two-player board game Push Fight, generalized to an arbitrary board and number of pieces. We prove that the game is PSPACE-hard to decide who will win from a given position, even for simple (almost rectangular) hole-free boards. We also analyze the mate-in-1 problem: can the player win in a single turn? One turn in Push Fight consists of up to two \"moves\" followed by a mandatory \"push\". With these rules, or generalizing the number of allowed moves to any constant, we show mate-in-1 can be solved in polynomial time. If, however, the number of moves per turn is part of the input, the problem becomes NP-complete. On the other hand, without any limit on the number of moves per turn, the problem becomes polynomially solvable again.","PeriodicalId":293763,"journal":{"name":"Fun with Algorithms","volume":"14 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2018-03-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"117148852","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Analyzing and Comparing On-Line News Sources via (Two-Layer) Incremental Clustering","authors":"Francesco Cambi, P. Crescenzi, L. Pagli","doi":"10.4230/LIPIcs.FUN.2016.9","DOIUrl":"https://doi.org/10.4230/LIPIcs.FUN.2016.9","url":null,"abstract":"In this paper, we analyse the contents of the web site of two Italian news agencies and of four \u0000of the most popular Italian newspapers, in order to answer questions such as what are the most \u0000relevant news, what is the average life of news, and how much different are different sites. To this \u0000aim, we have developed a web-based application which hourly collects the articles in the main \u0000column of the six web sites, implements an incremental clustering algorithm for grouping the \u0000articles into news, and finally allows the user to see the answer to the above questions. We have \u0000also designed and implemented a two-layer modification of the incremental clustering algorithm \u0000and executed some preliminary experimental evaluation of this modification: it turns out that \u0000the two-layer clustering is extremely efficient in terms of time performances, and it has quite \u0000good performances in terms of precision and recall.","PeriodicalId":293763,"journal":{"name":"Fun with Algorithms","volume":"271 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2016-06-08","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"116056195","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Building a Better Mouse Maze","authors":"J. Enright, John D. Faben","doi":"10.4230/LIPIcs.FUN.2016.15","DOIUrl":"https://doi.org/10.4230/LIPIcs.FUN.2016.15","url":null,"abstract":"Mouse Maze is a Flash game about Squeaky, a mouse who has to navigate a subset of the grid using a simple deterministic rule, which naturally generalises to a game on arbitrary graphs with some interesting chaotic dynamics. We present the results of some evolutionary algorithms which generate graphs which effectively trap Squeaky in the maze for long periods of time, and some theoretical results on how long he can be trapped. We then discuss what would happen to Squeaky if he couldn't count, and present some open problems in the area.","PeriodicalId":293763,"journal":{"name":"Fun with Algorithms","volume":"19 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2016-06-08","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"115287622","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
E. Demaine, Fermi Ma, Ariel Schvartzman, Erik Waingarten, S. Aaronson
{"title":"The Fewest Clues Problem","authors":"E. Demaine, Fermi Ma, Ariel Schvartzman, Erik Waingarten, S. Aaronson","doi":"10.4230/LIPIcs.FUN.2016.12","DOIUrl":"https://doi.org/10.4230/LIPIcs.FUN.2016.12","url":null,"abstract":"When analyzing the computational complexity of well-known puzzles, most papers consider the algorithmic challenge of solving a given instance of (a generalized form of) the puzzle. We take a different approach by analyzing the computational complexity of designing a \"good\" puzzle. We assume a puzzle maker designs part of an instance, but before publishing it, wants to ensure that the puzzle has a unique solution. Given a puzzle, we introduce the FCP (fewest clues problem) version of the problem: \u0000 \u0000Given an instance to a puzzle, what is the minimum number of clues we must add in order to make the instance uniquely solvable? \u0000 \u0000We analyze this question for the Nikoli puzzles Sudoku, Shakashaka, and Akari. Solving these puzzles is NP-complete, and we show their FCP versions are Sigma_2^P-complete. Along the way, we show that the FCP versions of 3SAT, 1-in-3SAT, Triangle Partition, Planar 3SAT, and Latin Square are all Sigma_2^P-complete. We show that even problems in P have difficult FCP versions, sometimes even Sigma_2^P-complete, though \"closed under cluing\" problems are in the (presumably) smaller class NP; for example, FCP 2SAT is NP-complete.","PeriodicalId":293763,"journal":{"name":"Fun with Algorithms","volume":"18 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2016-06-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"125570053","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"The Complexity of Snake","authors":"M. D. Biasi, Tim Ophelders","doi":"10.4230/LIPIcs.FUN.2016.11","DOIUrl":"https://doi.org/10.4230/LIPIcs.FUN.2016.11","url":null,"abstract":"Snake and Nibbler are two well-known video games in which a snake slithers through a maze and grows as it collects food. During this process, the snake must avoid any collision with its tail. Various goals can be associated with these video games, such as avoiding the tail as long as possible, or collecting a certain amount of food, or reaching some target location. Unfortunately, like many other motion-planning problems, even very restricted variants are computationally intractable. In particular, we prove the NP--hardness of collecting all food on solid grid graphs; as well as its PSPACE-completeness on general grid graphs. Moreover, given an initial and a target configuration of the snake, moving from one configuration to the other is PSPACE-complete, even on grid graphs without food, or with an initially short snake. \u0000Our results make use of the nondeterministic constraint logic framework by Hearn and Demaine, which has been used to analyze the computational complexity of many games and puzzles. We extend this framework for the analysis of puzzles whose initial state is chosen by the player.","PeriodicalId":293763,"journal":{"name":"Fun with Algorithms","volume":"30 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2016-06-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"131532406","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Super Mario Bros. is Harder/Easier Than We Thought","authors":"E. Demaine, G. Viglietta, A. Williams","doi":"10.4230/LIPIcs.FUN.2016.13","DOIUrl":"https://doi.org/10.4230/LIPIcs.FUN.2016.13","url":null,"abstract":"Mario is back! In this sequel, we prove that solving a generalized level of Super Mario Bros. is PSPACE-complete, strengthening the previous NP-hardness result (FUN 2014). Both our PSPACE-hardness and the previous NP-hardness use levels of arbitrary dimensions and require either arbitrarily large screens or a game engine that remembers the state of off-screen sprites. We also analyze the complexity of the less general case where the screen size is constant, the number of on-screen sprites is constant, and the game engine forgets the state of everything substantially off-screen, as in most, if not all, Super Mario Bros. video games. In this case we prove that the game is solvable in polynomial time, assuming levels are explicitly encoded; on the other hand, if levels can be represented using run-length encoding, then the problem is weakly NP-hard (even if levels have only constant height, as in the video games). All of our hardness proofs are also resilient to known glitches in Super Mario Bros., unlike the previous NP-hardness proof.","PeriodicalId":293763,"journal":{"name":"Fun with Algorithms","volume":"82 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2016-06-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"124560032","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"How Brokers Can Optimally Abuse Traders","authors":"Manuel Lafond","doi":"10.4230/LIPIcs.FUN.2022.18","DOIUrl":"https://doi.org/10.4230/LIPIcs.FUN.2022.18","url":null,"abstract":"Traders buy and sell financial instruments in hopes of making profit, and brokers are responsible for the transaction. There are several hypotheses and conspiracy theories arguing that in some situations, brokers want their traders to lose money. For instance, a broker may want to protect the positions of a privileged customer. Another example is that some brokers take positions opposite to their traders', in which case they make money whenever their traders lose money. These are reasons for which brokers might manipulate prices in order to maximize the losses of their traders. In this paper, our goal is to perform this shady task optimally -- or at least to check whether this can actually be done algorithmically. Assuming total control over the price of an asset (ignoring the usual aspects of finance such as market conditions, external influence or stochasticity), we show how in quadratic time, given a set of trades specified by a stop-loss and a take-profit price, a broker can find a maximum loss price movement. We also look at an online trade model where broker and trader exchange turns, each trying to make a profit. We show in which condition either side can make a profit, and that the best option for the trader is to never trade.","PeriodicalId":293763,"journal":{"name":"Fun with Algorithms","volume":"04 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2016-04-08","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"129470848","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Luciano Gualà, S. Leucci, Emanuele Natale, R. Tauraso
{"title":"Large Peg-Army Maneuvers","authors":"Luciano Gualà, S. Leucci, Emanuele Natale, R. Tauraso","doi":"10.4230/LIPIcs.FUN.2016.18","DOIUrl":"https://doi.org/10.4230/LIPIcs.FUN.2016.18","url":null,"abstract":"Despite its long history, the classical game of peg solitaire continues to attract the attention of the scientific community. In this paper, we consider two problems with an algorithmic flavour which are related with this game, namely Solitaire-Reachability and Solitaire-Army. In the first one, we show that deciding whether there is a sequence of jumps which allows a given initial configuration of pegs to reach a target position is NP-complete. Regarding Solitaire-Army, the aim is to successfully deploy an army of pegs in a given region of the board in order to reach a target position. By solving an auxiliary problem with relaxed constraints, we are able to answer some open questions raised by Cs'ak'any and Juh'asz (Mathematics Magazine, 2000). To appreciate the combinatorial beauty of our solutions, we recommend to visit the gallery of animations provided at this http URL","PeriodicalId":293763,"journal":{"name":"Fun with Algorithms","volume":"29 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2016-03-02","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"122019807","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Selenite Towers Move Faster Than Hanoï Towers, But Still Require Exponential Time","authors":"Jérémy Félix Barbay","doi":"10.4230/LIPIcs.FUN.2016.5","DOIUrl":"https://doi.org/10.4230/LIPIcs.FUN.2016.5","url":null,"abstract":"The Hanoi Tower problem is a classic exercise in recursive programming: the solution has a simple recursive definition, and its complexity and the matching lower bound correspond to the solution of a simple recursive function (the solution is so simple that most students memorize it and regurgitate it at exams without truly understanding it). We describe how some minor change in the rules of the Hanoi Tower yields various increases of difficulty in the solution, so that to require a deeper mastery of recursion than the classical Hanoi Tower problem. In particular, we analyze the Selenite Tower problem, where just changing the insertion and extraction positions from the top to the middle of the tower results in a surprising increase in the intricacy of the solution: such a tower of n disks can be optimally moved in 3^(n/2) moves for n even (i.e. less than a Hanoi Tower of same height), via 5 recursive functions (or, equivalently, one recursion function with five states following three distinct patterns).","PeriodicalId":293763,"journal":{"name":"Fun with Algorithms","volume":"2013 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2016-02-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"133755966","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}