2048 game
C++ Projects

2048 Game In C++ With Source Code

Project: 2048 Game In C++ With Source Code

Please scroll down and click on the download button to download 2048 Game project for free

This 2048 Game is based on a concept of colliding the same two numbers to create a new number with the total sum of the two numbers. This whole system is in C++ language. This game is a single player interesting game. It is played on a 4×4 grid, with numbers that slide smoothly when a player moves them using the four arrow keys. Every turn, a new number will randomly appear in an empty spot on the board with a value of either 2 or 4. It is very effective and simple understanding for beginners.

About System

2048 Game project is designed in ‘C++’ language. This system is based on a concept to move numbers on a grid to merge them to form the number 2048. However, you can keep on playing the game by creating larger numbers. In each move, a new number of displays (2 or 4). The player has to move the numbers using arrow keys and try to collide the same two numbers which create a new number with the total sum of the two numbers. Numbers slide as far as possible in the chosen direction until they strike on either another number or the edge of the grid. Also,this project is easy to operate and understood by the users.


  • up arrow– to move upward
  • down arrow– to move downward
  • left arrow– to slide the numbers to the left
  • right arrow– to slide the numbers to the right

How To Run the Project?

In order to run the project, you must have installed Dev C++ or Code Blocks on your PC. (we recommend these IDE). For the project demo, have a look at the video below:

project demo


If stuck or need help customizing this game as per your need, just comment down below and we will do our best to answer your question ASAP.

0 0 votes
Article Rating
Notify of
Newest Most Voted
Inline Feedbacks
View all comments
6 months ago

Hi, this code is ok, but it’s buggy and the terminal design has seen better days. I improved that with setw() using #include , having space for integers of max tile value 99999. 131072 will not be reached, that’s why 5 spaces is enough. i add those in a for-loop. I actually implemented it myself today and enhances the detection of possile moves and legal addPiece() execution. Here is a bug, where it adds a piece, disregarding the fact, that a move in that dirction is not possible. In this code, the only check that is done is in the… Read more »

1 month ago

How can i enlarged the size of the grid/box to 6*6 and 8*8? I’ve tried doing it by changing the matrix or every “4” to 8 it worked but there are still error on the movement.

Would love your thoughts, please comment.x