0% found this document useful (0 votes)
31 views8 pages

DSA - Course Project - 2048

The document outlines a course project for developing the 2048 game, emphasizing the application of data structures and algorithms. It details the game's mechanics, user interface, and a five-week development plan for a team of 2-3 members, covering tasks from team formation to testing and finalization. Additionally, it includes submission guidelines, assessment criteria, and notices regarding group work and academic integrity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views8 pages

DSA - Course Project - 2048

The document outlines a course project for developing the 2048 game, emphasizing the application of data structures and algorithms. It details the game's mechanics, user interface, and a five-week development plan for a team of 2-3 members, covering tasks from team formation to testing and finalization. Additionally, it includes submission guidelines, assessment criteria, and notices regarding group work and academic integrity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Course Project Data structures and Algorithms CSC10004

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.

Figure 1: In-game screenshot. You can try it via this link.

In this project, students will develop the 2048 game, applying their knowledge of data structures
and algorithms, including:

• Arrays: Using two-dimensional arrays to represent the 4 × 4 game board.

• Abstract Data Types: Using queues for tile merging and stacks for undo functionality.

• Search Algorithms: Checking the game state.

• Sorting Algorithms: Managing the leaderboard.

• Hashing Techniques: Encrypting passwords for login authentication.

• Trees: Storing and managing the player database.

University of Science Faculty of Information Technology Page 1


Course Project Data structures and Algorithms CSC10004

2 Game Description
This section provides a detailed breakdown of the game’s key components. Each subsection outlines
specific features and their implementation considerations.

2.1 Graphical User Interface (GUI)


The game interface can be implemented using either a console or a graphics library like SFML.

2.2 Login Screen


The login screen is the first interface displayed upon launching the game, allowing users to either
log in or create a new account.
To manage user database, the system should store user information in a tree-based data structure
(e.g., Binary Search Tree (BST), AVL Tree, etc.), where each node contains a username as the key
and a hashed password as the value. Plain-text passwords must not be stored to ensure security.
Notes: This may be a hard feature, you can implement it after completing the basic gameplay.

2.3 Start Menu


The start menu serves as the primary navigation hub, offering players the following options:

• 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.

• Game Settings: Allows players to customize game parameters, including:

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.

University of Science Faculty of Information Technology Page 2


Course Project Data structures and Algorithms CSC10004

2.4 Main Game Screen


In this main game screen, the game is displayed based on the settings configured in section 2.3.
The game includes the following functionalities:

• 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.

• Tiles should be visually distinct using color, size, etc.

• 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.

University of Science Faculty of Information Technology Page 3


Course Project Data structures and Algorithms CSC10004

3 Plan and Outcome


The following documentation outlines the detailed five-week plan for developing the 2048 game.
The project is designed for a team of 2 to 3 members, focusing on implementing gameplay logic,
user interface, and data management. By following this schedule, the team will achieve a functional
and well-optimized final product.

3.1 Week 1: Team Formation and Environment Setup


Goals:

• Establish a well-organized development team with clear roles.

• Set up a collaborative working environment.

• Define project scope, technologies, and initial design.

Tasks:

1. Team Formation and Role Assignment

• Game Logic Developer: Implements movement and merging logic.


• UI Developer: Develops the graphical interface.
• Data Management Developer: Handles user authentication and leaderboard.

2. Setting Up Collaboration Tools

• Google Drive for documentation.


• Trello or Notion for task management.
• GitHub for version control.
• Slack, Discord, Facebook Messenger Group, Zalo Group, etc for communication.

3. Defining the Project Scope and Technology Stack

• Programming Language: C/C++.


• Graphics: SFML or Console UI.
• Data Storage: Binary File, BST (Binary Search Tree).

Expected Outcome: The team is fully established, tools are set up, and an initial project design
is completed.

University of Science Faculty of Information Technology Page 4


Course Project Data structures and Algorithms CSC10004

3.2 Week 2: Implementing Basic Game Logic


Goals:

• Implement fundamental gameplay mechanics.

• Display game board in a console (or initial GUI prototype).

Tasks:

1. Implement the game board as a 4x4 grid using a 2D array.

2. Develop functions for tile movements: left, right, up, down.

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.

5. Display the board on console or as a simple graphical interface.

Expected Outcome: The game should be playable in a basic form, with correct tile movement
and merging.

3.3 Week 3: Advanced Game Mechanics and Data Management


Goals:

• Implement scoring, undo/redo system, and user authentication.

• Develop leaderboard functionality.

• Enable saving and loading game progress.

Tasks:

1. Implement scoring based on tile merging.

2. Create a leaderboard stored in Binary File and BST.

3. Implement an undo/redo system using stack.

4. Develop user authentication using BST with hashed passwords.

5. Implement save/load functionality for game states.

Expected Outcome: Players can save and load games, manage accounts, and use undo/redo
functionality.

University of Science Faculty of Information Technology Page 5


Course Project Data structures and Algorithms CSC10004

3.4 Week 4: User Interface and Gameplay Enhancement


Goals:
• Develop a graphical interface (SFML or improved console UI).

• Implement menus for game navigation.

• Allow customization of game settings.


Tasks:
1. Create a GUI for the game board, animations, and tile effects.

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.

3.5 Week 5: Testing, Debugging, and Finalization


Goals:
• Conduct testing and fix bugs.

• Optimize game performance and responsiveness.

• Prepare final documentation and demonstration.


Tasks:
1. Perform functional and stress testing.

2. Optimize movement logic for efficiency.

3. Improve GUI responsiveness and visual effects.

4. Write technical documentation and user guide.

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.

University of Science Faculty of Information Technology Page 6


Course Project Data structures and Algorithms CSC10004

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:

StudentID1 StudentID2 ...


Source
main.cpp
README.txt (instructions for running the game)
...
Report.pdf (including demo video URL)

If the submission file exceeds 25MB, upload it to Google Drive Storage and provide a public link.
No modifications are allowed after the deadline.

4.1 Report Submission


Submit a well-formatted PDF report that includes:

• Project Planning and Task Distribution: Detailed document team responsibilities,


which includes information on each task assigned to team members and the completion rate.
E.g., Student A has percentage of completion 90% and the group work has total score of 9.0,
then A receives a score of 9.0 * 90% = 8.1.

• Game Implementation Details: Explanation of the game mechanics, movement logic,


tile merging algorithms, and how player scores and game states are stored and retrieved.

• References: Any external materials or sources used.

4.2 Video Submission


Upload a demonstration video to YouTube/Google Drive and include the public link in the report.
The video should cover:

• Graphical Interface: Presentation of the Game UI, board layout, and animations.

• Gameplay Features: Demonstration of the game movement, merging, highscore updates,


undo/redo, and save/load functionalities.

University of Science Faculty of Information Technology Page 7


Course Project Data structures and Algorithms CSC10004

5 Assessment

No. Details Score

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:

• This is a GROUP assignment. Each group has 2 - 3 members.


Groups with fewer or more members than the specified limit require lab instructor approval.

• Duration: about 5 weeks. No late submission.

• 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.

University of Science Faculty of Information Technology Page 8

You might also like