0% found this document useful (0 votes)
12 views25 pages

Final Project Report Print

Uploaded by

samhithapala
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)
12 views25 pages

Final Project Report Print

Uploaded by

samhithapala
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/ 25

A Summer Industry Internship – I Report

on
“2048 game with python”
During
II year II semester Summer

Submitted to
The Department of Data Science
In partial fulfillment of the academic requirements of
Jawaharlal Nehru Technological University
For
The award of the degree of

Bachelor of Technology
in
DATA SCIENCE
By
Name: G.AKSHITHA Roll no: 21311A6721

Name of Internship Coordinator:


Dr.K.Premnadh
Associate Professor
Department of Data Science

Sreenidhi Institute of Science and Technology


Yamnampet, Ghatkesar, R.R. District, Hyderabad – 50130
Affiliated to Jawaharlal Nehru Technology University
Hyderabad-500805

Department of Data Science


Sreenidhi Institute of Science and Technology
CERTIFICATE

This is to certify that this Summer Industry Internship – I Report on “2048 game with
python”, submitted by G. Akshitha (21311A6721) in the year 2024 in partial fulfillment of
the academic requirements of Jawaharlal Nehru Technological University for the award of
the degree of Bachelor of Technology in Computer Science and Engineering, is a bonafide
work in industry internship that has been carried out during II II Semester Summer, will
be evaluated in III I Semester , under our guidance. This report has not been submitted to
any other institute or university for the award of any degree.

Dr. K. Premnadh Dr . Jaffer Sadiq


Associate Professor Professor
Department of DataScience Department of Data
Science
Internship Coordinator Head of the deparment

External Examiner

Date:-
DECLARATION

I, G. Akshitha (21311A6721), student of SREENIDHI INSTITUTE OF SCIENCE AND


TECHNOLOGY, YAMNAMPET, GHATKESAR, studying III rd year I st semester, DATA
SCIENCE solemnly declare that the Summer Industry Internship-I Report, titled “2048
game with python” is submitted to SREENIDHI INSTITUTE OF SCIENCE

AND TECHNOLOGY for partial fulfillment for the award of degree of Bachelor of
technology in DATA SCIENCE It is declared to the best of our knowledge that the work
reported does not form part of any dissertation submitted to any other University or Institute
for award of any degree.
G.Akshitha,
21311A6721
ACKNOWLEDGEMENT

I would like to express my gratitude to all the people behind the screen who helped me to
transform an idea into a real application.

I would like to thank my Summer Industry Internship Coordinator, Dr. K. Premnadh for
his/her technical guidance, constant encouragement and support in carrying out my project at
college.

I profoundly thank Dr. Jaffer Sadiq, Head of the Department of Data Science who has been
an excellent guide and also a great source of inspiration to my work.

I would like to express my heart-felt gratitude to my parents without whom I would not have
been privileged to achieve and fulfill my dreams. I am grateful to our principal, Dr. T. Ch.
Siva Reddy, who most ably run the institution and has had the major hand in enabling me to
do my project.

The satisfaction and euphoria that accompany the successful completion of the task would be
great but incomplete without the mention of the people who made it possible with their
constant guidance and encouragement crowns all the efforts with success. In this context, I
would like thank all the other staff members, both teaching and non-teaching, who have
extended their timely help and eased my task.

G.AKSHITHA
21311A6721
INDEX
page no.
Abstract 1
1.Introduction 2

2.Project Objectives 3

3.System requirements 4

4.System Architecture 5

5.Implementation 6-13

6.Result 14-15

7.Future enhancements 17

8.Conclusion 18
ABSTRACT

The project titled "Implementation of the 2048 Game in Python" focuses on


creating a digital version of the popular 2048 puzzle game using the Python
programming language. The 2048 game is a single-player sliding puzzle that
challenges players to combine numbered tiles on a 4x4 grid to achieve the
elusive 2048 tile. The primary objective of this project is to provide an engaging
and interactive implementation of the game, showcasing the application of
fundamental programming concepts and techniques.

The implementation involves creating a graphical user interface (GUI) using a


Python library, Tkinter, to render the game board and facilitate user
interactions. The game logic encompasses the handling of player input,
movement of tiles, and the merging of identical tiles when they collide. The
scoring system and win/lose conditions are also integral components of the
game logic, contributing to the overall user experience.

Throughout the development process, emphasis is placed on code modularity,


readability, and adherence to best coding practices. The project aims to serve as
an educational resource for novice programmers, providing insights into game
development, graphical interface design, and algorithmic problem-solving.
Additionally, the implementation encourages experimentation and further
customization by allowing users to modify game parameters, such as grid size
or target tile value.

The report covers the project's background, objectives, methodology, challenges


faced during implementation, and the overall design structure. The codebase is
discussed in detail, highlighting key algorithms and functions responsible for
the game's functionality. Evaluation metrics, including the efficiency of the
code and user feedback, are presented to assess the project's success in
achieving its goals.

In conclusion, the "Implementation of the 2048 Game in Python" project serves


as a practical and educational exploration of game development using Python.
By providing a playable and customizable version of the 2048 game, the project
aims to inspire and assist aspiring programmers in their journey to mastering the
art of software development.

1
1.Introduction

The allure of puzzle games lies not only in their entertainment


value but also in their ability to challenge our cognitive skills.
In this report, we delve into the world of game development
using Python, focusing on the iconic 2048 game. Originating
as a solo project by Gabriele Cirulli in 2014, 2048 has since
captivated audiences with its simple yet addictive gameplay.
Our objective is to dissect the mechanics of the game, explore
the implementation process in Python, and highlight strategic
considerations that can enhance the player’s experience. Join
us on this journey as we unravel the intricacies of coding and
strategy in the context of the popular 2048 game.

2.Project objectives
Game Implementation: Develop a functional 2048 game
using Python, ensuring that the game mechanics align with the
original rules.

User Interface (UI): Create an intuitive and visually


appealing user interface for the game, allowing players to
interact seamlessly.

Scoring System: Implement a scoring system that accurately


reflects the player’s performance and adherence to the 2048
game rules.

Game Logic: Ensure the game logic is robust, preventing


unintended moves or glitches that could disrupt the gaming
experience.

Compatibility: Ensure the game runs smoothly on various


Python environments and platforms without significant
compatibility issues.

3
3.System Requirements
Programming Language: Python is the primary language for
implementing the game logic.

Tkinter
Python offers multiple options for developing GUI (Graphical User
Interface). Out of all the GUI methods, tkinter is the most commonly
used method. It is a standard Python interface to the Tk GUI toolkit
shipped with Python. Python tkinter is the fastest and easiest way to
create GUI applications. Creating a GUI using tkinter is an easy task.

Random module

The Python Random module is a built-in module for generating


random integers in Python. These numbers occur randomly and does
not follow any rules or instructions. We can therefore use this module
to generate random numbers, display a random item for a list or
string, and so on.

The random() Function


The random.random() function gives a float number that ranges from
0.0 to 1.0. There are no parameters required for this function. This
method returns the second random floating-point value within [0.0
and 1] is returned.

Python IDLE:
Python IDLE (Integrated Development and Learning Environment) is
a basic, lightweight Integrated Development Environment that comes
bundled with the Python programming language.

4
4.System architecture
5
5.Implementation

Below is the structure of python 2048 game:


1. Importing modules
2. Creating display function
3. Define Function
4. Creating main function

IMPORTING MODULES
Tkinter :
• Purpose: Tkinter is the standard GUI toolkit that comes
with Python. While Pygame is often used for game
graphics, Tkinter might be considered for creating a
simple graphical user interface (GUI) for settings, score
display, or game information.
• Usage: Creating a minimalistic GUI for displaying game
information or providing additional settings.

Random:
• Purpose: The built-in random module in Python
provides functions for generating pseudo-random
numbers. It's useful for placing initial tiles randomly on
the game grid.
• Usage: Randomly placing new tiles with values of 2 or 4
at empty positions during
the game initialization.

CREATING DISPLAY FUNCTION


DEFINE FUNCTIONS
a . new_tiles()
This function will add new tiles to the game window when we
perform any movement in game.
The tiles will have either number 2 or number 4 and the new
generated tiles will have different colors for both the numbers

7
b.full()
This function will check whether all the grid in the game is
full or not. It will return either True or False.

c.show_board()
This function will show the game board. Each number in the
game window will have a separate color. The numbers in the
game board are 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 and
2048.

8
d. show_number0()
This function will have to show the color of the grid when
there is no number on it.

e.show_number()
This function will show the color of the grid and number as
respect to the different numbers.

f. moves()
This function will accept the different events performed by
the user and perform the movement of blocks of grid as per
the event. The events given by the user are ‘UP’, ‘DOWN’,
‘LEFT’, and ‘RIGHT’.
9
10
g. new_game()
This function will create a new game for the user. It will
display a fresh game with the last highest score of the user.

h. game_over()

This function will check for game over, it will return True if
the game is over and display a new empty grid window
displaying “GAME OVER”.
11
i.game_won()
This function will check for a game won and condition for
game won is the user has to make a grid of value 2048, then it
will return True and display a new empty grid window
displaying “GAMEWON!”.

12
Creating the main function
In the main function, the main window of tkinter is made and
the creation of objects for the main class is done. In this
function, we will pass the user moves, title of our project, size
of game window.

13
6.Result

14
15
7.Future Enhancements

Multiplayer Mode:
Introduce a multiplayer mode where two players can compete
against each other in real-time. This could be done locally or
over a network.

Customizable Grid Size:


Allow users to customize the size of the grid, providing them
with options to play on smaller or larger boards.

Themes and Skins:


Add different themes or skins to change the appearance of the
game. This could include different color schemes,
backgrounds, and tile designs.

Difficulty Levels:
Implement difficulty levels with varying complexities. For
example, easy mode can have larger tile values, while hard
mode can have smaller tile values, making it more
challenging.

Tutorial Mode:
Include a tutorial mode that guides new players through the
rules and strategies of the game.

16
8.Conclusion:

In conclusion, the development of the "2048 game with


Python" project has been a rewarding and educational
experience. Through the course of this project, I successfully
implemented the popular 2048 game using the Python
programming language. The project involved various aspects
of software development, including algorithm design, user
interface implementation, and problem-solving.

The core functionality of the game, including the merging of


tiles, user input handling, and the win/lose conditions, was
implemented with efficiency and effectiveness in mind. The
graphical user interface (GUI) was designed to provide a user-
friendly and visually appealing experience.
Throughout the development process, I encountered
challenges that required thoughtful problem-solving and
debugging. These challenges not only deepened my
understanding of Python programming but also honed my
skills in identifying and resolving issues in a systematic
manner.

The modular and object-oriented approach taken in this


project promotes code reusability and maintainability,
ensuring that future enhancements or modifications can be
made with ease. The project serves as a practical example of
how Python can be used to create engaging and interactive
games, contributing to the broader understanding of software
development principles.

17
In conclusion, the "2048 game with Python" project has
provided valuable insights into game development,
algorithmic thinking, and the application of programming
concepts. It has been an opportunity to apply theoretical
knowledge to a real-world project, reinforcing the importance
of hands-on experience in the learning process.

Overall, this project has been a success, achieving its


objectives of implementing a functional and enjoyable 2048
game using Python. As I reflect on the journey of
development, I recognize the growth in my programming
skills and problem-solving capabilities, making this project a
significant milestone in my learning journey.

18

You might also like