Students develop a complete version of the popular puzzle game 2048 by incrementally building its core functionality in Java. They begin by exploring the game mechanics and writing methods to place initial tiles on the board. Next, they implement movement logic to slide and merge tiles in all four directions while updating the score. Students then add a method to detect when the game is over and an optional feature to track and save high scores. Throughout the lab, they reinforce skills in 2D array traversal, control structures, and algorithmic problem-solving while applying object-oriented programming principles to manage game state and user interaction.
This lab can be completed after Unit 4: Data Collections in Cortado, Unit 7: ArrayList in Nitro (with Using Text Files lesson from Cortado), Unit 5: Data Structures in Mocha (with Using Text Files lesson from Cortado).