2048 Game Using C++
2048 Game Using C++
2048 Game Using C++
By
Ishaan Kumar
AJU/210217
JAMSHEDPUR, JHARKHAND
This is to certify that the project entitled “2048 Game Using C++”, is bonafide
work of Ishaan Kumar bearing enrolment Number: AJU/210217 under the
guidance of Mr. Akash Bhagat submitted in partial fulfilment of the requirement
for the award of degree in BACHELOR OF COMPUTER APPLICATION from
ARKA JAIN UNIVERSITY, JHARKHAND during the year 2021 - 2022.
Creating a 2048 Game in C++ language is an excellent method to become acquainted with a
new computer using C++ programming language.
The game primarily evaluates the game player’s status based on the two-dimensional array of
player activities (press the buttons W, A, S and D to move).
I would like to express my special thanks of gratitude to my mentor Mr. Akash Bhagat who
gave me the golden opportunity to do this wonderful project on “2048 Game Using C++”.
Last but not the least I would like to thank my batch mates who have helped me a lot.
DECLARATION
I, Ishaan Kumar, hereby declare that the Project entitled “2048 Game using C++”done at
ARKA JAIN UNIVERSITY has not been in any case duplicated to submit to any other
university for the award of any degree. To the best of my knowledge other than me, no one has
submitted to any other university.
This project is done in partial fulfilment of the requirement for the award of degree of
BACHELOR OF COMPUTER APPLICATION to be submitted as final semester project as
part of our curriculum.
Ishaan Kumar
AJU/210217
CONTENTS
• Specification Requirement
• Code
• Conclusion
• Reference
SPECIFICATION REQUIREMENT
Hardware:
• Intel i3 minimum
• Minimum 64 MB RAM
• At least 32 GB storage
Software:
• OS: Windows 7
• Dev C++
• Code::Blocks
CODE
#include<bits/stdc++.h>
#include<conio.h>
using namespace std;
void up(int a[4][4])//Moving the contents Up
{
int i,j,lt,ri;
for(j=0;j<4;j++)
{
lt=0,ri=j;
for(i=1;i<4;i++)
{
if(a[i][j]!=0)
{
if(a[i-1][j]==0||a[i-1][j]==a[i][j])
{
if(a[lt][ri]==a[i][j])
{
a[lt][ri]*=2;
a[i][j]=0;
}
else
{
if(a[lt][ri]==0)
{
a[lt][ri]=a[i][j];
a[i][j]=0;
}
else
{
a[++lt][ri]=a[i][j];
a[i][j]=0;
}
}
}
else
{
lt++;
}
}
}
}
}
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
if(temp[i][j]!=a[i][j])
{
f=0;
break;
}
}
}
return(f);
}
It was a wonderful and learning experience for me while working on this project. This
project took me through the various phases of project development. The joy and the thrill
involved while tackling the various problems and challenges gave me a feel of
developer’s industry.
I enjoyed each and every bit of work I had put into this mini project i.e.,”2048 Game
Using C++”.
REFERENCE
• https://code-projects.org
• https://www.geeksforgeeks.org
• Programming in ANSI C
• https://ofstack.com
OUTPUT