Another Way to Solve Nine-Tails Franz Delahan* William F. Klostermeyer ? George Trapp t *Dept. of Mathematics University of California Irvine, C A 92717 tDept, of Stat. and Computer Science West Virginia University Morgantown, WV 26506-6330 e-mail: {wfk, trapp}@es.wvu.edu 1. Introduction In the nine-tails problem, a three by three matrix of coins is given, some heads up and some tails up. A player must flip coins so as to achieve an all tails configuration. However, when a player flips a particular coin, its rectilinearly adjacent neighbors (i.e. its left, right, top and bottom neighbors, if they exist) also flip over. In the March 1995 issue of SIGCSE Bulletin [1], Heck gives a dynamic programming algorithm to solve the nine-tails problem. Heck's stated goal was to provide a interesting problem to illustrate the often mystical concept of dynamic programming. In the worst case, Heck's dynamic programming algorithm examines all 29 = 512 distinct configurations of coins in order to find the shortest sequence of flips by which the player can achieve the all tails configuration. We present a more efficient approach to finding a shortest sequence of flips. 2. Nine-Tails Algorithm We number the coins as in the matrix
/lp/association-for-computing-machinery/another-way-to-solve-nine-tails-g7oq6qVHIH