0% found this document useful (0 votes)
1K views4 pages

2048 Game On Python Project Synopsis

This document describes a project to create the 2048 game in Python. It provides background on the original 2048 game and describes how it will be coded using the Python programming language and Tkinter GUI toolkit. It discusses conducting a feasibility study and developing a methodology, including planning the logic for moving tiles in each direction and checking for game completion or a win. Implementation will be done solely by the student Achintya Upadhyay. Software requirements include a PC, the Python programming language, Tkinter for the GUI, and Pygame for images and sound.

Uploaded by

Rhody Flash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views4 pages

2048 Game On Python Project Synopsis

This document describes a project to create the 2048 game in Python. It provides background on the original 2048 game and describes how it will be coded using the Python programming language and Tkinter GUI toolkit. It discusses conducting a feasibility study and developing a methodology, including planning the logic for moving tiles in each direction and checking for game completion or a win. Implementation will be done solely by the student Achintya Upadhyay. Software requirements include a PC, the Python programming language, Tkinter for the GUI, and Pygame for images and sound.

Uploaded by

Rhody Flash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

2048 Game in Python

Submitted in partial fulfillment of the requirements for the award of degree of


BACHELOR OF ENGINEERING
IN
COMPUTER SCIENCE & ENGINEERING

Submitted to:
Puneet Kaur

Submitted By:
Achintya Upadhyay
19BCS1714

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


Chandigarh University, Gharuan
September 2021
Introduction

2048 is a single-player sliding tile puzzle video game written by Italian web developer Gabriele Cirulli and
published on GitHub. The objective of the game is to slide numbered tiles on a grid to combine them to
create a tile with the number 2048; however, one can continue to play the game after reaching the goal,
creating tiles with larger numbers. It was originally written in JavaScript and CSS over a weekend, and
released on 9 March 2014 as free and open-source software subject to the MIT License. Versions
for iOS and Android followed in May 2014.

2048 is played on a plain 4×4 grid, with numbered tiles that slide when a player moves them using the
four arrow keys. Every turn, a new tile randomly appears in an empty spot on the board with a value of
either 2 or 4. Tiles slide as far as possible in the chosen direction until they are stopped by either another
tile or the edge of the grid. If two tiles of the same number collide while moving, they will merge into a tile
with the total value of the two tiles that collided. The resulting tile cannot merge with another tile again in
the same move. Higher-scoring tiles emit a soft glow; the highest possible tile is 131,072.[7]

If a move causes three consecutive tiles of the same value to slide together, only the two tiles farthest
along the direction of motion will combine. If all four spaces in a row or column are filled with tiles of the
same value, a move parallel to that row/column will combine the first two and last two. A scoreboard on
the upper-right keeps track of the user's score. The user's score starts at zero, and is increased whenever
two tiles combine, by the value of the new tile.
The game is won when a tile with a value of 2048 appears on the board. Players can continue beyond
that to reach higher scores. When the player has no legal moves (there are no empty spaces and no
adjacent tiles with the same value), the game ends.

The language being used to create this game is Python with the help of the software Tkinter.

Python is an interpreted high-level general-purpose programming language. Its design philosophy


emphasizes code readability with its use of significant indentation. Its language constructs as well as
its object-oriented approach aim to help programmers write clear, logical code for small and large-scale
projects.
Python is dynamically-typed and garbage-collected. It supports multiple programming paradigms,
including structured (particularly, procedural), object-oriented and functional programming. It is often
described as a "batteries included" language due to its comprehensive standard library.
Guido van Rossum began working on Python in the late 1980s, as a successor to the ABC programming
language, and first released it in 1991 as Python 0.9.0. Python 2.0 was released in 2000 and introduced
new features, such as list comprehensions and a garbage collection system using reference counting.
Python 3.0 was released in 2008 and was a major revision of the language that is not
completely backward-compatible. Python 2 was discontinued with version 2.7.18 in 2020.
Python consistently ranks as one of the most popular programming languages.

Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI


toolkit, and is Python's de facto standard GUI. Tkinter is included with standard Linux, Microsoft
Windows and Mac OS X installs of Python.
Feasibility Study

Solving this game is an interesting problem because it has a random component. It’s impossible to
correctly predict not only where each new tile will be placed, but whether it will be a “2” or a “4”.
As such, it is impossible to have an algorithm that will correctly solve the puzzle every time. The best that
we can do is determine what is likely to be the best move at each stage and play the probability game.
At any point, there are only four possible moves that we can make. Sometimes, some of these moves
have no impact on the board and are thus not worth making – for example, in the above board a move of
“Down” will have no impact since all of the tiles are already on the bottom edge.
The challenge is then to determine which of these four moves is going to be the one that has the best
long-term outcome.

Methodology/ Planning of work 

1. For left swipe, we will just compress and then merge the grid cell matrix and then if compress or
merge is true (indicating the values of the matrix is affected by previous two functions), then we need
to compress the grid again.
2. For moving up, we will take transpose then swipe left and again take transpose to return to the
original order.
3. Moving down is same as moving up but we need to reverse the matrix.
4. Similarly, right is same as moving left + reverse.
After every operation, we need to check the game status, if all cells are occupied and we cannot even
merge any two cells i.e. the state where no movement can change the matrix, then the game is over.

If any cell value has reached 2048, then the player is won and a message box is flashed on the screen
announcing the winner.

Module & Team Member wise Distribution of work

Everything from planning and coding to presentation and submission will be done by me
Achintya Upadhyay
19BCS1714
CSE5 (A)

Software and Hardware Requirements

A PC and Tkinter software for Python code also Pygame to incorporate images and sound to the game.
Bibliography

https://en.wikipedia.org/wiki/2048_(video_game)

https://en.wikipedia.org/wiki/Python_(programming_language)

https://en.wikipedia.org/wiki/Tkinter

https://www.baeldung.com/cs/2048-algorithm

You might also like