Learn Java in N Games

This repository contains a collection of game-based activities for learning about Java programming.


To install Learn Java in N Games, you will need:

The Java Development Kit: http://www.oracle.com/technetwork/java/javase/downloads/index.html

The Eclipse IDE for Java Developers: https://eclipse.org/downloads/

The Princeton Standard Library file stdlib.jar: http://introcs.cs.princeton.edu/java/stdlib/


  1. Click on “Download .zip” at the top of this page. This should download a file called something like PeterDrake-ljing2-skeletons-ff35eae.zip. Move the file someplace more permanent than your downloads directory and unzip it. Rename the resulting directory ljing.

  2. Open Eclipse. If you have never used Eclipse before, choose the default workspace and click on "Go to the workbench".

  3. File → Import → General → Existing Projects into Workspace. Next.

  4. In “Select root directory”, enter the path to the ljing directory you created in step 1. Many projects (starting with Anagrams) should be listed in the Projects area. Finish.

  5. Eclipse → Preferences → Java → Build Path → Classpath Variables. New. Enter STDLIB (exactly like that) in the Name field and the path to stdlib.jar in the Path field. OK. OK.

  6. Now expand the Shut the Box project, src, and (default package) to find ShutTheBox.java. Right-click on it and select Run As → Java Application. The game should run in the text console. If this worked, you’re good to go! (If not, please contact drake@lclark.edu for help.)


The Learn Java in N Games activities can be used individually or as a complete curriculum for a second course in computer science. While no specific accompanying textbook is required, Sedgewick and Wayne’s Introduction to Programming in Java: An Interdisciplinary Approach is a good choice. There are three types of activities:

There are a total of 30 activities. These could be used one per day in a 10-week course that meets three times a week. In a slightly longer semester, the extra time could be used for review, additional topics, exams, and a final project.

The activities have the following order:

  1. Shut the Box (POGIL)

  2. Data Types, Control Structures, and Teamwork (Lecture slides)

  3. Pig (Project)

  4. Tic-Tac-Toe (POGIL)

  5. Arrays, Comments, Graphics, and Management (Lecture slides)

  6. Domineering (Project)

  7. Anagrams (POGIL)

  8. Methods, Libraries, Debugging, and Information Processing (Lecture slides)

  9. Snowman (Project)

  10. Towers of Hanoi (POGIL)

  11. Recursion and Critical Thinking (Lecture slides)

  12. Maze (Project)

  13. Beetle (POGIL)

  14. Using Objects and Problem Solving (Lecture slides)

  15. Text Adventure (Project)

  16. Pong (POGIL)

  17. Designing Objects, UML, and Communication (Lecture slides)

  18. Asteroid Rally (Project)

  19. High Scores I (POGIL)

  20. Analysis, Searching, Sorting, and Assessment (Lecture slides)

  21. Poker Dice (Project)

  22. Railyard (POGIL)

  23. Interfaces, Stacks, and Queues (Lecture slides)

  24. Focus (Project)

  25. High Scores II (POGIL)

  26. Sets, Maps, and Trees (Lecture slides)

  27. Questions (Project)

  28. Hex (POGIL)

  29. Graphs (Lecture slides)

  30. Go (Project)

There is a PDF in each POGIL activity or project explaining what to do. The lecture slides are in the Learn Java in N Games Overview project.

Instructors may contact drake@lclark.edu for further information and solutions. Solutions will not be given to students.


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.


This work was supported by the Google Education and Relations Fund's CS Engagement Small Grant Program grant #TFR15-00411.

The principal investigator, Peter Drake, wishes to thank the following for their useful comments: the members of the CS-POGIL project, specifically Clif Kussmaul and Helen Hu; Maggie Dreyer; and various anonymous reviewers.