Course Level
Other
Knowledge Unit
Development Methods
Collection Item Type
Assignment
Synopsis

Traffic Jam is an assignment designed for a CS3-style course that is meant to (re-)introduce students to larger programming projects. Students implement a grid-based puzzle game based on the sliding block puzzle game Rush Hour. In the game, a player must slide adjacent cars facing horizontally or vertically in order to dislodge a particular car and move it to the other side of the grid.

This assignment consists of scaffolded instructions, UML diagrams, and starter files that guide students through the process of creating the game in four parts. This allows students to build on their work and to work on increasingly complex goals, from a text-based version to a graphical user interface in Java using the ACM Java library.

For this assignment, students should be familiar with arrays, methods, references, and classes. The project aims to help students gain more experience and proficiency with classes and object-oriented design in Java, as well as with event handlers and interactivity. Students learn how to read existing code and supplement it with new features to build a prototype of the game.

Upon completion of this assignment, students will be able to: 

  • Design and implement robust Java classes to model complex game entities.
  • Manipulate 2D-arrays and manage object references to represent and update a grid-based game state.
  • Apply the Model-View-Controller (MVC) pattern to separate the underlying game logic from both console-based and graphical user interfaces.
  • Construct event-driven graphical interfaces using external libraries to handle user inputs (e.g. mouse dragging and clicking).

ACM Digital Library Entry

Recommendations

The Traffic Jam assignment typically takes (at least) four weeks, which translates to one week for each of its four parts, including time to work on it both inside and outside of class.

Students at our institution study CS1 and CS2 in a different programming language (C++), so for many of them this is the first time that they encounter Java. We also have a sizeable population of transfer students and, for them, this is often one of the first courses they take at our institution. This means that the students in this course tend to have a wide range of programming experiences.

Most of the students in the course have little to no familiarity with Java in particular, with most having only seen C++ or Python. The decision to use a different programming language in this course was a deliberate choice in order to help prepare students for future experiences with new programming languages, e.g. in the workplace. The most common struggles students encounter center around object-oriented programming, so we would recommend providing additional or optional materials that students can seek out to support their switch to Java (if applicable).

Finally, this course is designed to provide students with a project-based experience. However, our experience has been that having students choose their projects at the beginning of the semester can be challenging. Therefore, we created this individual assignment to give students an example of what a project might look like before they begin working on their own team projects later in the course. Similar to a summer book given to students before they come to campus, this assignment is then meant to build a shared understanding and language between the students in the course. 

Engagement Highlights

This project aligns with the NCWIT engagement framework by using meaningful and relevant content, giving effective encouragement, and offering student-centered assessments.

In terms of meaningful and relevant content, this assignment gives students the opportunity to create a prototype of a game that mirrors what they might find in an app store and play on their phone. In fact, the idea for this assignment grew out of a student project from an earlier iteration of the course.

Regarding giving effective encouragement, the project aims to make it okay to make mistakes. As the four parts of the assignment build on each other, it can be challenging for students when issues from earlier parts affect later parts of the project. We address this by allowing students to modify code that was completed in earlier parts. Additionally, in the final part of the project, students have the option to use their own code or to build on an existing functional solution of the earlier parts.

Finally, in terms of offering student-centered assessments, we aim to encourage students to seek help. Traffic Jam is designed to help students identify areas where they might need further support and students are regularly encouraged (both in the assignment and in class) to seek additional support from TAs, through office hours, or in tutoring. We also provide additional asynchronous resources for students who may be intimidated by office hours, such as narrated PowerPoint slides, videos (e.g. on null pointer exceptions), a document with frequently asked questions, and labs to introduce interactivity in the graphical interface (included here as well).

Computer Science Details

Programming Language
Java

Material Format and Licensing Information

Creative Commons License
CC BY-NC-SA