Natural Computing

, Volume 11, Issue 3, pp 353–359 | Cite as

A genetic algorithm for the Zen Puzzle Garden game

  • Martyn AmosEmail author
  • Jack Coldridge


In this paper we present a novel genetic algorithm (GA) solution to a simple yet challenging commercial puzzle game known as Zen Puzzle Garden (ZPG). We describe the game in detail, before presenting a suitable encoding scheme and fitness function for candidate solutions. By constructing a simulator for the game, we compare the performance of the GA with that of the A* algorithm. We show that the GA is competitive with informed search in terms of solution quality, and significantly out-performs it in terms of computational resource requirements. By highlighting relevant features of the game we hope to stimulate further work on its study, and we conclude by presenting several possible areas for future research.


Genetic algorithm Transport puzzle NP-complete Game A* 



The authors thank Joseph White (author of ZPG) for invaluable assistance with the game, David Corne for useful advice on representation schemes, and David Goldberg (1989b) and Robert M. Pirsig (1976) for titular inspiration.


  1. Berger MS, Lawton JH (2007) Multi-agent planning in Sokoban. Multi-agent systems and applications V. Lecture notes in computer science, vol 4696. Springer, pp 334–336Google Scholar
  2. Botea A, Müller M, Schaeffer J (2003) Using abstraction for planning in Sokoban. In Schaeffer J, Müller M, Björnsson Y (eds) Computers and Games 2002, number 2883 in Lecture notes in computer science. Springer Verlag, pp 360–375Google Scholar
  3. Dechter R, Pearl J (1985) Generalized best-first strategies and the optimality of A*. J ACM 32(3):505–536MathSciNetzbMATHCrossRefGoogle Scholar
  4. Demaine ED, Hoffmann M (2001) Pushing blocks is NP-complete for noncrossing solution paths. Proceedings of the 13th Canadian Conference on Computational Geometry (CCCG 2001), Waterloo, Ontario, Canada, 13–15 August 2001, pp 65–68Google Scholar
  5. Dor D, Zwick U (1999) SOKOBAN and other motion planning problems. Comput Geom Theory Appl 13(4):215–228MathSciNetzbMATHCrossRefGoogle Scholar
  6. Goldberg DE (1989a) Genetic algorithms in search, optimization, and machine learning. Addison-Wesley, BostonzbMATHGoogle Scholar
  7. Goldberg DE (1989b) Zen and the art of genetic algorithms. Proceedings of the 3rd international conference on genetic algorithms, pp 80–85Google Scholar
  8. Hart PE, Nilsson NJ, Raphael B (1968) A formal basis for the heuristic determination of minimum cost paths. IEEE Trans Syst Sci Cybern 4(2):100–107CrossRefGoogle Scholar
  9. Hong T-P, Huang J-Y, Lin W-Y (2002) Applying genetic algorithms to game search trees. Soft Comput 6(3–4):277–283zbMATHCrossRefGoogle Scholar
  10. Houston R, White J, Amos M (2011) Zen puzzle garden is NP-complete (submitted)Google Scholar
  11. Junghanns A, Schaeffer J (2001a) Sokoban: enhancing general single-agent search methods using domain knowledge. Artif Intell 129(1–2):219–251MathSciNetzbMATHCrossRefGoogle Scholar
  12. Junghanns A, Schaeffer J (2001b) Sokoban: improving the search with relevance cuts. Theor Comput Sci 252(1–2):151–175MathSciNetzbMATHCrossRefGoogle Scholar
  13. Kendall, G, Spoerer, K (2004) Scripting the game of Lemmings with a genetic algorithm. Proceedings of the 2004 Congress on Evolutionary Computation (CEC2004), June 19–23, Portland, Oregon, USA, IEEE Press, pp 117–124Google Scholar
  14. Kendall G, Parkes A, Spoerer K (2008) A survey of NP-complete puzzles. ICGA J 31(1):13–34Google Scholar
  15. Korf RE (1997) Finding optimal solutions to Rubik’s Cube using pattern databases. Proceedings of the AAAI Conference on Artificial Intelligence, Providence, RI, USA, Wiley, pp. 700–705Google Scholar
  16. Lexaloffle Games. Zen Puzzle Garden. Trial version downloadable at
  17. Mantere T, Koljonen J (2007) Solving, rating and generating Sodoku puzzles with GA. Proceedings IEEE Congress on Evolutionary Computation (CEC) September 25–28, 2007, Singapore, IEEE Press, pp 1382–1389Google Scholar
  18. Meffert K, Rotstan N, Knowles C, Sangiorgi U JGAP: Java genetic algorithms and genetic programming package.
  19. Osborne MJ, Rubinstein A (1999) A course in game theory. MIT Press, CambridgeGoogle Scholar
  20. Pirsig RM (1976) Zen and the art of motorcycle maintenance. Corgi, LondonGoogle Scholar

Copyright information

© Springer Science+Business Media B.V. 2011

Authors and Affiliations

  1. 1.School of Computing, Mathematics and Digital TechnologyManchester Metropolitan UniversityManchesterUK

Personalised recommendations