0% found this document useful (0 votes)
14 views6 pages

Project Report Template (2)

The document outlines a project to develop a console-based implementation of the 2048 game using C++ and object-oriented programming principles. It details the game's mechanics, objectives, features, proposed class structure, and inheritance types used in the project. The conclusion emphasizes the successful application of OOP concepts to create a modular and scalable codebase, enhancing the gaming experience.

Uploaded by

tahsin2209016
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)
14 views6 pages

Project Report Template (2)

The document outlines a project to develop a console-based implementation of the 2048 game using C++ and object-oriented programming principles. It details the game's mechanics, objectives, features, proposed class structure, and inheritance types used in the project. The conclusion emphasizes the successful application of OOP concepts to create a modular and scalable codebase, enhancing the gaming experience.

Uploaded by

tahsin2209016
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/ 6

Open Ended Lab

On

2048 GAME
using C++ Programming Language

Course No: CSE 2100


Course Name: Object Oriented Programming Laboratory

Submitted By-
Fariha Tahsin
Roll: 2209016

10th February 2025

Department of Electronics and Communication Engineering


Khulna University of Engineering & Technology
Khulna-9203, Bangladesh.
Introduction
Project Overview
This project aims to develop a console-based implementation of the 2048 game using C++
and object-oriented programming (OOP) principles.
Game Description
2048 is a sliding tile puzzle game that challenges players to combine numbered tiles into larger
values. The objective is to create the 2048 tile by merging tiles of the same value. Each move
shifts tiles in one direction (Up, Down, Left, or Right), merging adjacent tiles of the same value
and adding a new tile to the grid.
Key gameplay mechanics:
1. Sliding tiles in one of four directions (Up, Down, Left, Right).
2. Merging tiles with the same value during a slide.
3. Randomly adding new tiles (2, 4, 8, 16 or 32) to the grid after each move.
4. Ending the game when no valid moves remain or when the player achieves the 2048
tile.
Objectives
1. To implement the basic mechanics of 2048, including tile sliding, merging, and grid
updates.
2. To provide clear feedback for win or game-over states.
3. To use OOP principles (class, object, encapsulation, inheritance, abstraction and
polymorphism) to ensure a modular and reusable codebase.
4. To display the grid in a visually appealing format and provide intuitive controls (W,
A, S, D for movement, Q to quit).

Features
1. Dynamic Grid Updates:
o A 4x4 grid updates in real-time after each move.
o New tiles (2, 4, 8, 16 or 32) are generated dynamically based on gameplay
progression. For example: First there will be 2 and 4 tile. After five moves,
2, 4 and 8 will be generated. Then after ten moves, 2, 4, 8 and 16 will be
generated randomly.

2. Win and Game-Over Conditions:


o Players win upon creating the 2048 tile.
o The game ends if no valid moves are available.

2
3. Tile Sliding and Merging:
o Will be implemented as modular strategies for each direction (Move_Up,
Move_Down, Move_Left, Move_Right).

4. Interactive Console Interface:


o A clean and intuitive console interface will display the grid, with clear
prompts for user input.

Here’s a simple chart that represents the flow of the 2048 game implementation.

3
Proposed Class Structure
1. Grid Class:
o Managing the grid state (a 2D array).
o Initializing the grid.
o Tile Generation: Randomly adding a new tile (2, 4, 8, 16 or 32) to an empty
position after each move.
o Win/ Loss Detection: Detecting when the 2048 tile is created or when no
valid moves are available.
o Grid Display: Formatting and display the grid for a clear user interface.

2. Move Classes (Move_Up, Move_Down, Move_Left, Move_Right):


o Implementing the specific behaviors for moving and merging tiles in each
direction.

3. Game_2048 Class:
o Managing the game loop and interactions with the Grid object.
o Accepting user input (W (up), A (left), S (down), D (right), Q(quit)).
o Managing the game state and triggering win/loss conditions.

Inheritance used in this project


1. Single Inheritance: Base_Move only inherits from one parent class
(Move_Strategy), this is single inheritance.
2. Hierarchical Inheritance: Move_Up, Move_Down, Move_Left, Move_Right all
inherit from Base_Move. Since multiple classes inherit from the same base class,
this is hierarchical inheritance.

4
5
Conclusion
This project is a practical implementation of the popular 2048 game using C++ and object-
oriented programming (OOP) principles. The game demonstrates the successful use of key
OOP concepts such as encapsulation, inheritance, polymorphism, and abstraction to create a
clean, modular, and scalable codebase. The console-based design ensures that players enjoy an
interactive and engaging experience, while the modular architecture allows for easy future
enhancements like scoring, undo functionality, or even a graphical interface. This project
highlights how OOP can be effectively used to build robust and maintainable software
solutions.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy