Fall 2024 - CS611 - 2 - SOL
Fall 2024 - CS611 - 2 - SOL
02 Total Marks: 20
Semester: Fall 2024
CS611 – Software Quality Engineering Due Date: 04-01-2025
Solution File
Instructions
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:
Assignment Syllabus:
For any query about the assignment, contact through email at [email protected]
2048 Puzzle Game
Game Link: https://play2048.co/ (Open it in any browser and play the game)
The 2048 Game is a simple, yet addictive puzzle game. The goal is to slide tiles on a grid and combine them to
create a tile with the number 2048. Here's how it works:
Basic Rules
Grid and Tiles:
The game is played on a 4x4 grid.
At the start, two tiles appear randomly, each showing the number 2 or 4.
Tile Movement:
Use arrow keys (or swipe gestures on mobile) to move all tiles on the grid in one of four directions: up,
down, left, or right.
All tiles move as far as possible in the chosen direction until they hit the grid's edge or another tile.
Combining Tiles:
When two tiles with the same number collide during a move, they merge into one tile with their numbers
summed (e.g., 2 + 2 = 4, 4 + 4 = 8, etc.).
The resulting tile cannot merge again in the same move.
New Tile:
After every move, a new tile with a value of 2 or 4 appears at a random empty spot on the grid.
Winning Condition:
The game is won when a tile with the number 2048 appears on the grid.
Losing Condition:
The game ends when no moves are possible, i.e., when the grid is full, and no adjacent tiles can be
combined.
Scoring:
Your score increases by the value of the tiles you merge during the game.
Tips:
Focus on creating larger tiles while keeping your grid as clear as possible.
Try to keep your highest tile in one corner for better control.
Avoid spreading tiles randomly to reduce the chances of losing space for movement.
Question:
You are tasked with defining the functional requirements for a software project to develop a "2048 Game."
1. Identify four functional requirements that the game must fulfill to ensure proper gameplay.
2. For each requirement, provide a brief example or scenario that demonstrates its implementation.
Solution:
Functional Requirements:
1. Tile Movement:
o Requirement: The game must allow tiles to move in one of four directions (up, down, left, or
right) when the player uses the corresponding input.
o Example: When the player presses the left arrow key, all tiles should slide to the left until they
reach the grid edge or another tile.
2. Tile Merging:
o Requirement: Tiles with the same number must merge into a single tile with their summed value
when they collide during movement.
o Example: Two "4" tiles collide during a leftward move, merging to create a single "8" tile.
3. Score Calculation:
o Requirement: The game must update the score by adding the value of merged tiles to the player’s
total score.
o Example: If two "16" tiles merge into a "32" tile, the score increases by 32.
4. Game Over Detection:
o Requirement: The game must detect when no moves are possible and display a "Game Over"
message.
o Example: The grid is completely filled, and no adjacent tiles have the same value. The game ends,
and a message appears notifying the player.
.………*****……….
Best of Luck ☺