Optimal Solitaire Game Solutions using A∗ Search and Deadlock Analysis Gerald Paul Malte Helmert Boston University University of Basel Boston, Massachusetts, USA Basel, Switzerland
[email protected] [email protected] Abstract Windows implementation of the game. Because the random- ization algorithm for Freecell deals is public (Horne 2015), We propose and implement an efficient method for determin- given a seed the random deals are reproducible, so compar- ing optimal solutions to such skill-based solitaire card games as Freecell and King Albert solitaire. We use A* search to- isons can be made with other work. While Freecell differs gether with an admissible heuristic function that is based on in detail from other skill solitaire games, such concepts as analyzing a directed graph whose cycles represent deadlock foundation cells to which cards must ultimately be moved, situations in the game state. To the best of our knowledge, and a tableau of columns of cards is common to many skill ours is the first algorithm that efficiently determines optimal solitaire games. Freecell has been shown to be NP-hard solutions for Freecell games. We believe that the underlying (Helmert 2003) and thus provides a demanding test of our ideas should be applicable not only to games but also to other approach. classical planning problems which manifest deadlocks. There are a number of Freecell computer solvers avail- able which provide solutions to any Freecell deal (Elyasaf, 1 Introduction Hauptman, and Sipper 2011; Fish 2015; Heineman 2015; Games have always been a fertile ground for advancements Keller 2015; PySolFC 2015). However, we know of no optimal in computer science, operations research and artificial in- work which provides provably solutions to solitaire telligence.