Professional Documents
Culture Documents
Harsh Jha
• XI - Science
• Roll No. - 32
Mihir Patel
• XI - Science
• Roll No. - 39
TABLE OF CONTENT
01 09
ACKNOWLEDGEMENT TESTING
expressing my special thanks of gratitude Testing the Software.
to my teacher as well as our principal. (PONG GAME)
[Page no. 1] [Page no. 26]
10
BIBLIOGRAPHY
02
INTRODUCTION A list Sources that has been
Introducing Our Software used in preparing the Software.
(PONG GAME) [Page no. 27]
[Page no. 3]
03
CONCEPT
Concept of software used for
developing software.
[Page no. 4]
04
ABOUT
Breif Introduction to python And Mysql
programing Languages.
[Page no. 5 & 11]
05
INSTALLATTION
Procedure for the Installation of
Software (PONG GAME)
[Page no. 10 & 16]
06
REQUIREMNTS
Hardware and Software Requirements
for the Software.
[Page no. 17]
07
SOURCE CODE
Source code of the Software.
(PONG GAME)
[Page no. 18]
08
OUTPUT
Output of the Software.
(PONG GAME)
[Page no. 26]
Acknowledgement
While I was preparing this project file, Various
Information that I found helped me and I am glad that I
was able to complete this project and understand many
things. Through preparation of this Informatics Practices
Project was an Immense learning Experience and I
inculcated many personal qualities during this process
like responsibility, punctuality, confidence and many
more.
01
PONG
GAME
02
INTRODUCTION
𝐂𝐫𝐞𝐚𝐭𝐞 𝐩𝐨𝐧𝐠 𝐠𝐚𝐦𝐞 𝐮𝐬𝐢𝐧𝐠 𝐏𝐲𝐭𝐡𝐨𝐧 – 𝐓𝐮𝐫𝐭𝐥𝐞
Page no. 03
CONCEPT OF
SOFTWARE USED FOR
DEVELOPING SOFTWARE
we have used Python and the Turtle
library to create a simple Pong game.
The game is similar to an actual game
of table tennis, where two players will
use keys to move two paddles up and
down on either side of the game screen.
Users will use these to deflect a ball
and prevent it from hitting the edge of
the screen on their side. The game is
lots of fun to play, and its’ simple
code makes it the perfect project for
kids or those who are new to Python to
create. Regardless of your proficiency
with Python, this project is a great
way to test your knowledge and learn
more about making a functional program.
Page no. 04
Introduction to Python
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.
Page no. 05
History of Python
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. Guido van Rossum
Page no. 06
Naming of Python :
Python's name is derived from the
British comedy group Monty Python,
whom Python creator Guido van
Rossum enjoyed while developing the
language. Monty Python references p
dy gro u
Come
appear frequently in Python code and y Py th o n (19 69)
Mo nt
culture; for example, the metasyntactic
variables often used in Python literature are spam and eggs instead
of the traditional foo and bar. The official Python documentation
also contains various references to Monty Python routines.
Python Libraries :
Python's large standard library, commonly cited as one of its greatest
strengths, provides tools suited to many tasks.
For Internet-facing applications, many standard formats and protocols
such as MIME and HTTP are supported. It includes modules for
creating graphical user interfaces, connecting to relational databases,
generating pseudorandom numbers, arithmetic with arbitrary-
precision decimals, manipulating regular expressions, and unit testing.
Some of the Popular python Libraries are :-
TensorFlow, Scikit-Learn, Numpy, Keras, PyTorch, LightGBM,
Eli5, SciPy.
Page no. 07
What is Python used for?
AI and machine learning
Data analytics
Data visualisation
Programming applications
Web development
Game development
Language developmentFinance
Search engine optimisation (SEO)
Natural language processing (NLP)
modify files.
mathematics.
software development.
Page no. 08
Why Python?
There are Some of the Reasons Listed below
that why Python is mostly preferred :-
Page no. 09
Installation Procedure Of
Python
1] Select Version of Python to Install
Python has various versions available with differences between the syntax
and working of different versions of the language. We need to choose the version which
we want to use or need. There are different versions of Python 2 and Python 3 available.
Page no. 10
Introduction to MySQL
MySQL is an open-source relational database
management system (RDBMS). Its name is a
combination of "My", the name of co-founder
Michael Widenius's daughter, and "SQL", the
abbreviation for Structured Query Language. A
relational database organizes data into one or
more data tables in which data types may be
related to each other; these relations help
structure the data. SQL is a language
programmers use to create, modify and extract
data from the relational database, as well as
control user access to the database. In addition to
relational databases and SQL, an RDBMS like
MySQL works with an operating system to
implement a relational database in a computer's
storage system, manages users, allows for network
access and facilitates testing database integrity and
creation of backups.
Page no. 11
History of MySQL
MySQL was created by a Swedish
company, MySQL AB, founded by
Swedes David Axmark, Allan Larsson
and Finland Swede Michael "Monty"
Widenius. Original development of
MySQL by Widenius and Axmark
began in 1994. The first version of
David Axmark and Michael "Monty" Widenius
MySQL appeared on 23 May 1995.
Page no. 12
Features of MySQL
MySQL is offered under two different editions: the open
source MySQL Community Server and the proprietary
Enterprise Server. MySQL Enterprise Server is differentiated
by a series of proprietary extensions which install as server
plugins, but otherwise shares the version numbering system
and is built from the same code base.
MySQL is open-source :
Any individual or enterprise may freely use, modify, publish, and expand on
Oracle's open-source MySQL code base. The software is released under
the GNU General Public License (GPL). For MySQL code needing to be
integrated or included in a commercial
application (or if open-source software is not a priority), enterprises can
purchase a commercially licensed version from Oracle.
Page no. 13
MySQL is widely compatible :
Though often associated with internet applications or web services, MySQL
was designed to be extensively compatible with other technologies and
architectures. The RDBMS runs on all major computing platforms, including
Unix-based operating systems, such as the myriad Linux distributions or
Mac OS, and Windows.
MySQL's client-server architecture means it can support a variety of
backends, as well as different programming interfaces. Data can be directly
migrated from MySQL to its forks (e.g. MariaDB), as well as most other
RDBMSS thanks to architectural and language similarities.
MySQL can run on very modest hardwareand puts very little strain on system
resources; many small users serve up information to their organizations by
running MySQL on modest desktop systems. The speed with which it can
retrieve information has made it a longstanding favorite of web administrators.
MySQL can run on very modest hardwareand puts very little strain on system
resources; many small users serve up information to their organizations by
running MySQL on modest desktop systems. The speed with which it can
retrieve information has made it a longstanding favorite of web administrators.
Page no. 14
MySQL databases are relational :
The primary factor differentiating relational databases from other digital
storage lies in how data is organized at a high level. Databases like
MySQL contain records in multiple, separate, and highly codified
tables, as opposed to a single all-encompassing repository, or
collections of semi or unstructured documents.
This allows RDBMSS to better optimize actions like data retrieval,
updating information, or more complex actions like aggregations. A
logical model is defined over all of the contents of the database,
describing for example the values allowed in individual columns,
characteristics of tables and views, or how indices from two tables are
related.
Relational models have remained popular for several reasons. They
empower users with intuitive, declarative programming languages -
essentially telling the database what result is wanted in language akin
to, or at least comprehensible as, written english, instead of
meticulously coding up each step of the procedure leading to that
result. This moves a lot of the work into the RDBMS and SQL engines,
better enforcing logical rules and saving valuable resources and
manpower.
Page no. 15
Installation Procedure Of
MySQL
Page no. 16
Hardware &
Software
Requirements
1] Operating system :
Linux- Ubuntu 16.04 to 17.10,
or Windows 7 to 11
Page no. 17
SOURCE CODE
import pygame
import sys
import random
from math import *
pygame.init()
width = 600
height = 400
display = pygame.display.set_mode((width, height))
pygame.display.set_caption("Pong!")
clock = pygame.time.Clock()
top = white
bottom = white
left = white
right = white
margin = 4
scoreLeft = 0
scoreRight = 0
maxScore = 20
Page no. 18
font = pygame.font.SysFont("Small Fonts", 30)
largeFont = pygame.font.SysFont("Small Fonts", 60)
l = 25
# Paddle Class
class Paddle:
def __init__(self, position):
self.w = 10
self.h = self.w*8
self.paddleSpeed = 6
if position == -1:
self.x = 1.5*margin
else:
self.x = width - 1.5*margin - self.w
Page no. 19
# Show the Paddle
def show(self):
pygame.draw.rect(display, white, (self.x, self.y,
self.w, self.h))
leftPaddle = Paddle(-1)
rightPaddle = Paddle(1)
# Ball Class
class Ball:
def __init__(self, color):
self.r = 20
self.x = width/2 - self.r/2
self.y = height/2 -self.r/2
self.color = color
self.angle = random.randint(-75, 75)
if random.randint(0, 1):
self.angle += 180
self.speed = 8
Page no. 20
# Move the Ball
def move(self):
global scoreLeft, scoreRight
self.x += self.speed*cos(radians(self.angle))
self.y += self.speed*sin(radians(self.angle))
if self.x + self.r > width - margin:
scoreLeft += 1
self.angle = 180 - self.angle
if self.x < margin:
scoreRight += 1
self.angle = 180 - self.angle
if self.y < margin:
self.angle = - self.angle
if self.y + self.r >=height - margin:
self.angle = - self.angle
Page no. 21
if leftPaddle.y + 50 < self.y < leftPaddle.y + 60
or leftPaddle.y + 50 < self.y + self.r< leftPaddle.y + 60:
self.angle = 15
if leftPaddle.y + 60 < self.y < leftPaddle.y + 70
or leftPaddle.y + 60 < self.y + self.r< leftPaddle.y + 70:
self.angle = 30
if leftPaddle.y + 70 < self.y < leftPaddle.y + 80
or leftPaddle.y + 70 < self.y + self.r< leftPaddle.y + 80:
self.angle = 45
else:
if rightPaddle.x + rightPaddle.w > self.x + self.r >
rightPaddle.x:
if rightPaddle.y < self.y < leftPaddle.y + 10 or
leftPaddle.y < self.y + self.r< leftPaddle.y + 10:
self.angle = -135
if rightPaddle.y + 10 < self.y < rightPaddle.y +
20 or rightPaddle.y + 10 < self.y + self.r< rightPaddle.y + 20:
self.angle = -150
if rightPaddle.y + 20 < self.y < rightPaddle.y +
30 or rightPaddle.y + 20 < self.y + self.r< rightPaddle.y + 30:
self.angle = -165
if rightPaddle.y + 30 < self.y < rightPaddle.y +
40 or rightPaddle.y + 30 < self.y + self.r< rightPaddle.y + 40:
self.angle = 170
if rightPaddle.y + 40 < self.y < rightPaddle.y +
50 or rightPaddle.y + 40 < self.y + self.r< rightPaddle.y + 50:
self.angle = 190
if rightPaddle.y + 50 < self.y < rightPaddle.y +
60 or rightPaddle.y + 50 < self.y + self.r< rightPaddle.y + 60:
self.angle = 165
if rightPaddle.y + 60 < self.y < rightPaddle.y +
70 or rightPaddle.y + 60 < self.y + self.r< rightPaddle.y + 70:
self.angle = 150
if rightPaddle.y + 70 < self.y < rightPaddle.y +
80 or rightPaddle.y + 70 < self.y + self.r< rightPaddle.y + 80:
self.angle = 135
Page no. 22
# Show the Score
def showScore():
leftScoreText = font.render("Score : " + str(scoreLeft),
True, red)
rightScoreText = font.render("Score : " + str(scoreRight),
True, blue)
# Game Over
def gameOver():
if scoreLeft == maxScore or scoreRight == maxScore:
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
close()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
close()
if event.key == pygame.K_r:
reset()
if scoreLeft == maxScore:
playerWins = largeFont.render("Left Player
Wins!", True, red)
elif scoreRight == maxScore:
playerWins = largeFont.render("Right Player
Wins!", True, blue)
Page no. 23
def reset():
global scoreLeft, scoreRight
scoreLeft = 0
scoreRight = 0
board()
def close():
pygame.quit()
sys.exit()
def board():
loop = True
leftChange = 0
rightChange = 0
ball = Ball(yellow)
while loop:
for event in pygame.event.get():
if event.type == pygame.QUIT:
close()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
close()
if event.key == pygame.K_SPACE or event.key ==
pygame.K_p:
Pause()
if event.key == pygame.K_r:
reset()
if event.key == pygame.K_w:
leftChange = -1
if event.key == pygame.K_s:
leftChange = 1
if event.key == pygame.K_UP:
rightChange = -1
if event.key == pygame.K_DOWN:
rightChange = 1
if event.type == pygame.KEYUP:
leftChange = 0
rightChange = 0
Page no. 24
leftPaddle.move(leftChange)
rightPaddle.move(rightChange)
ball.move()
ball.checkForPaddle()
display.fill(background)
showScore()
ball.show()
leftPaddle.show()
rightPaddle.show()
boundary()
gameOver()
pygame.display.update()
clock.tick(60)
board()
Page no. 25
Output & Testing
Page no. 26
BIBLIOGRAPHY
Our Source for this Project was
𝐒𝐔𝐌𝐈𝐓𝐀 𝐀𝐑𝐎𝐑𝐀'𝐒 Book of
𝗜𝗡𝗙𝗢𝗥𝗠𝗔𝗧𝗜𝗖𝗦
𝗣𝗥𝗔𝗖𝗧𝗜𝗖𝗘𝗦.
Also with the Assistance of Our
I.P Sir "𝐌𝐑. 𝐍𝐀𝐔𝐒𝐇𝐀𝐃 𝐊𝐇𝐀𝐍"
We have also taken help from several websites.
Projects By Medium
Page no. 27