Functional Video Games in CS1 II

From Structural Recursion to Generative and Accumulative Recursion
  • Marco T. Morazán
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7193)


The use of video games to teach introduction courses to programming and Computer Science is a trend that is currently flourishing. One of the most successful and promising approaches uses functional video games to get students interested and engaged in programming. This approach is successful, in part, because functional video games provide a domain of interest to most Computer Science undergraduates and remove the need to reason about designing state-based programs. A plethora of examples exist that have students develop games exploiting structural recursion which resemble such classics as Space Invaders and Snake. Once students master the basics of structural recursion the time comes to move beyond structural recursion to generative and accumulative recursion. It is up to the instructor to harness the enthusiasm and appetite that students have to develop more video games. This requires finding games that require the generation of subproblems in the same class as the input problem or that require accumulators to be successfully played or solved. This article presents a road map to make the transition from structural recursion to accumulative recursion using the N-puzzle problem as motivation to capture student enthusiasm and exploit what they have learned about program design. The N-Puzzle was also chosen to demonstrate that informed heuristic search strategies, traditionally the domain of undergraduate courses in Artificial Intelligence, are within the grasp of CS1 students. With proper guidance, CS1 students can reason such an algorithm into existence instead of simply using a textbook to study such algorithms. If the work described in this article is replicated elsewhere, there is no doubt that it will be an exciting time for Computer Science education and it will elevate the relevance of functional programming in the minds of future CS professionals.


Video Game Recursive Call Functional Programming Manhattan Distance Structural Recursion 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Felleisen, M., Findler, R.B., Fisler, K., Flatt, M., Krishnamurthi, S.: How to Design Worlds (2008),
  2. 2.
    Felleisen, M., Findler, R.B., Flatt, M., Krishnamurthi, S.: How to Design Programs: An Introduction to Programming and Computing. MIT Press, Cambridge (2001)zbMATHGoogle Scholar
  3. 3.
    Felleisen, M., Findler, R.B., Flatt, M., Krishnamurthi, S.: A Functional I/O System or, Fun for Freshman Kids. In: ICFP, pp. 47–58 (2009)Google Scholar
  4. 4.
    Findler, R.B., Clements, J., Flanagan, C., Flatt, M., Krishnamurthi, S., Steckler, P., Felleisen, M.: DrScheme: A Programming Environment for Scheme. Journal of Functional Programming 12(2), 159–182 (2002)zbMATHCrossRefGoogle Scholar
  5. 5.
    Markov, Z., Russell, I., Neller, T., Zlatareva, N.: Pedagogical Possibilities for the N-Puzzle Problem. In: Proceedings of the Frontiers in Education Conference, pp. S2F1–S2F6 (November 2006)Google Scholar
  6. 6.
    Morazán, M.T.: Functional Video Games in the CS1 Classroom. In: Page, R., Horváth, Z., Zsók, V. (eds.) TFP 2010. LNCS, vol. 6546, pp. 166–183. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  7. 7.
    Peyton-Jones, S.: Parallel Implementations of Functional Programming Languages. The Computer Journal 32(2) (1989)Google Scholar
  8. 8.
    Rich, E., Knight, K.: Artificial Intelligence. McGraw-Hill, New York (1991)Google Scholar
  9. 9.
    Russell, S.J., Norvig, P., Candy, J.F., Malik, J.M., Edwards, D.D.: Artificial intelligence: A Modern Approach. Prentice-Hall, Inc., Upper Saddle River (1996)Google Scholar
  10. 10.
    Szymanski, B.K.: Parallel Functional Languages and Compilers. Frontier Series. ACM Press, New York (1991)zbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Marco T. Morazán
    • 1
  1. 1.Seton Hall UniversitySouth OrangeUSA

Personalised recommendations