top of page

2048 Game

Course: CIS 1200 

Date: Dec 2024 

CIS 1200 is an introductory computer science course that emphasizes the design aspects of programming. Our final assignment was to recreate a game of our choosing using the Java Swing GUI framework. I choose to recreate the game 2048.

Overview

When the user launches the game, a pop-up window displays the game board. The gameboard includes buttons for New Game, Undo, Save, Reload, and Instructions. At the top of the window, the current score appears on the left, and the high score on the right. Starting a new game resets the current score to 0, while the high score remains. Clicking the Instructions button opens a pop-up window with game intstructions, which I formatted using HTML.

Gameplay

As the user clicks the arrow keys to combine tiles, if they are the same number they will combine, doubling in value and changing color. After each move, a "2" tile is generated in a random open cell on the board. Once the board is full and there is no more possible moves "Game Over" appears at the top of the board.

Key Features

As part of this assignment, I incorporated four important programming concepts we learned in class:

​

File I/O: Saved the entire game state, allowing users to save, exit out, and then reload their progress. 

​

Collections: Utilized a LinkedList to store a collection of game states for the undo feature.

​

2D Array: Used a 2D integer array to represent the internal state of my board so I could easily move tiles and change their value. 

​

JUnit Testable Component: Allowed me to test my core game logic, including the move-tile and tile generator functions. 

Videos

Demonstrates moving tiles

Demonstrates functioning buttons

bottom of page