DSA - Course Project - 2048
DSA - Course Project - 2048
Course Project
Game 2048
1 Introduction
The 2048 game is a popular single-player puzzle where the player slides numbered tiles on a grid
to combine them and create a tile with the number 2048. The game is played on a 4 × 4 grid,
each move shifts all tiles up, down, left, or right and merges tiles of the same value if they collide.
The challenge is to manage space wisely and plan moves carefully to avoid getting stuck.
In this project, students will develop the 2048 game, applying their knowledge of data structures
and algorithms, including:
• Abstract Data Types: Using queues for tile merging and stacks for undo functionality.
2 Game Description
This section provides a detailed breakdown of the game’s key components. Each subsection outlines
specific features and their implementation considerations.
• Continue Game: If the player previously exited the game, this option allows them to
continue their last game session from where they left off. If there is no saved game exists,
this option should be disabled.
• New Game: Initiates a new game session, transitioning the player to the main game screen
(see Section 2.4).
• Leaderboard: Displays the top 10 players ranked by score, along with their usernames,
maze sizes, completion times, and scores, sorted in descending order.
1. Board Size: Adjusts the game board dimensions (default: 4 × 4, maximum: 10 × 10).
2. Undo/Redo Functionality: Enables or disables the undo feature or both undo and
redo features (default: enabled).
3. Additional Settings: Provides other configurable options based on available features,
such as enabling or disabling sound effects if supported.
• At the start, two random tiles with values 2 or 4 appear on the board. After each move,
a new tile with a value of 2 or 4 will be placed randomly on the board.
• Players can move tiles using the arrow keys (Up, Down, Left, Right) or W, A, S, D keys
for up, left, down, and right movements, respectively.
• When a tile reaches the value of 2048, the system will display a congratulatory message and
notify the player if they qualify for the Leaderboard. The system will then prompt whether
the player wants to continue playing or exit. If the player want to exit, their data is stored,
and the system returns to the Start Window (2.3). If they continue, they can only stop by
pressing the E key (exit function).
• If there are no possible moves left, the system will be displaying a “Game Over” message
and show the player’s ranking if they qualify for the Leaderboard. In the case of resuming
the game, the player will use the undo function to continue playing. If the game is stopped,
the system will store the information if the player ranks in the Leaderboard.
• The system should display and update the player’s score during the game. The score is
calculated based on the sum of the values of merged tiles. Specifically, when two tiles with
the same value merge, the player’s score is increased by the value of the newly formed tile.
For example, merging two 4 tiles results in a 8 tile, adding 8 points to the score.
• The system should display the top player’s score. If the current player surpasses the top score,
the top score should be updated.
• The system should support undo and redo functionalities. Undo allows players to revert the
last move, while redo allows players to redo a move after undoing it. The availability of these
functions depends on the game settings. The U and R keys correspond to undo and redo,
respectively.
• The exit function allows the player to leave the game. If selected, a confirmation dialog
appears. If confirmed, the game state is saved and will be available in the Resume function.
If declined, the player returns to the ongoing game. The E key is used for exit.
Tasks:
Expected Outcome: The team is fully established, tools are set up, and an initial project design
is completed.
Tasks:
3. Implement merging logic when tiles of the same value collide using queue.
4. Create a function to check game state (win/loss condition) using search algorithm.
Expected Outcome: The game should be playable in a basic form, with correct tile movement
and merging.
Tasks:
Expected Outcome: Players can save and load games, manage accounts, and use undo/redo
functionality.
2. Develop a main menu with options: New Game, Resume, Leaderboard, Settings.
3. Implement settings for board size (4x4 to 10x10) and undo/redo toggle.
Expected Outcome: The game has a fully functional user interface with menu navigation and
customizable settings.
5. Prepare a demonstration.
Expected Outcome: A fully functional 2048 game with documentation and a working demo.
Notes: At the end of each week, the team is required to submit a comprehensive Weekly Report
on Moodle, detailing the tasks completed and the methodologies employed.
4 Submission
All your source code and documentation must be submitted as a compressed file (.zip, .7z or .rar)
named following the format: StudentID1_StudentID2_.... Here is an example details of the
directory organization:
If the submission file exceeds 25MB, upload it to Google Drive Storage and provide a public link.
No modifications are allowed after the deadline.
• Graphical Interface: Presentation of the Game UI, board layout, and animations.
5 Assessment
1 Game mechanics: Tile movement, merging logic, and win/loss conditions. 20%
2 User authentication: Account creation, login, and password hashing. 10%
3 Leaderboard: Sorting and displaying. 10%
4 Weekly Assignment 1: Team formation and environment setup. 10%
5 Weekly Assignment 2: Basic game mechanics implementation. 10%
6 Weekly Assignment 3: Advanced features (scoring, undo/redo, save/load). 10%
7 Weekly Assignment 4: UI integration and settings customization. 10%
8 Final report: System design, algorithms, and challenges. 10%
9 Demo video: Showcasing gameplay and key features. 10%
100%
6 Notices
Please pay attention to the following notices:
• AI tools are not restricted; however, students should use them wisely. Lab instructors have
the right to conduct additional oral interviews with random groups to assess their knowledge
of the project.
• Any plagiarism, any tricks, or any lie will have a 0 point for the course grade.
The end.