[go: up one dir, main page]

0% found this document useful (0 votes)
24 views23 pages

Documentation Final

This document is the final documentation

Uploaded by

khatheejatkubra
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)
24 views23 pages

Documentation Final

This document is the final documentation

Uploaded by

khatheejatkubra
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/ 23

INDEX

S.NO CONTENTS
Pg no

1. ABSTRACT 2

2. FEASABILITY STUDY 3

3. SYSTEM REQUIREMENT 4

4. ERROR AND ITS TYPES 5

5. TESTING 6

6. MAINTANANCE 7

7. MODULES USED 8

8. FLOW CHART 10

9. SOURCE CODE 12

10. SAMPLE OUTPUT 18

11. CONCLUSION 20

12. BIBLIOGRAPHY 21

1
ABSTRACT

Pong is more than just an old-school video game—it’s a piece of gaming


history. Released in 1972, it was one of the very first arcade games and is
often credited with sparking the video game industry as we know it. Created
by Atari’s Al Alcorn and Nolan Bushnell, Pong was inspired by table tennis,
capturing the simple thrill of the sport in a digital format.

In its purest form, Pong is a game of reflexes, strategy, and a little bit of
friendly rivalry. The gameplay is straightforward: two players control
paddles on either side of the screen, using them to bounce a square ball
back and forth. The goal? Keep the ball from getting past you and try to
outsmart your opponent to score points. It sounds simple, but the fast-
paced action makes it surprisingly challenging and addictive.

What makes Pong so special is its timeless appeal. Despite its simplicity, it
has a unique charm that still draws people in, whether you’re playing it for
the first time or revisiting a childhood favorite. It’s a reminder that
sometimes, the best games don’t need fancy graphics or complex storylines
—they just need a good idea and the right kind of fun.

2
FEASABILITY STUDY

Feasibility study is a system proposal according to its work, ability, impact


on the operation ability to meet the needs of users and efficient use of
resources. An important outcome of preliminary investigations the
determination of that system requested feasible.

1.1 Economical Feasibility:

This game can be fun because it helps us reduce stress and can challenge
Friend.

It is more valuable because this game does not cost any money. It is free
thus helping people to have fun with friends which can challenge Friend’s
High score. It ask username for saving score for Continue to beat there High
Score of themselves. People can check friend’s high score easily by CSV file.

1.2 Technical Feasibility:


 Simple user interface
 Login and Signup
 Enjoying with Game
 Saving the Score in a CSV file
 Can Play with User’s High Score
 Can Check Leader Board

3
SYSTEM REQUIREMENTS

2.1 MINIMUM:

Processor: Intel Core i3-2330M or (newer or equivalent)


Graphics Card: NVIDIA GeForce 410M
Disk: 100MB Storage
OS: Microsoft Windows 10
RAM: 2GB RAM

2.2 SOFTWARE:
Python (Version 3.11 or newer)

4
ERROR AND ITS TYPES
An error, some times called “A Bug” is anything in the code that prevents a
program from compiling and running correctly. There are broadly three
types of errors

3.1 Compile-time error: Errors that occur during compilation of a


program is called compile times error. It has two types as follows:

3.1.1 Syntax Error: It refers to formal rules governing the construction


of valid statements in a language.

3.1.2 Semantics Error: It refers to the set of rules which give the
meaning of a statement.

3.2 Runtime Error: Errors that occur during the execution of program
are runtime errors. These are harder to detect errors. Some runtime errors
stop the execution of program which is the called program “Crashed”.

3.3 Logical Error: Sometimes, even if you don’t encounter any error
during compiling-time and runtime, your program does not provide the
correct result. This is because the programmer’s mistaken analysis of the
problem he/she is trying to solve. Such errors are called logical errors.

TESTING
5
4.1 Alpha Testing: It is the most common type of testing used in the
software industry. The objective of this testing is to identify all possible
issues or defects before releasing it into the market or to the user. It is
conducted at the developer’s site.

4.2 Beta Testing: It is a formal type of software testing which is carried


out by the customers. It is performed in a real environment before releasing
the products into the market for the actual endusers. It is carried out to
ensure that there is no major failures in the software or product and it
satisfies the business requirement. Beta Testing is successful when the
customer accepts the software.

4.3 White Box Testing: White Box Testing is based on the knowledge
about the internal logic of an application’s code. It is also known as Glass
Box Testing. Internal software and code working should be known for
programming this type of testing. These tests are based in the coverage of
the code statements, branches, paths, conditions, etc.

4.4 Black Box Testing: It is a software testing method in which the


internal structure or design of the item to be tested is not known to the
tester. This method of testing can be applied virtually to every level of the
software testing.

6.MAINTENANCE

6
Programming maintenance refers to the modifications in the program. After
it has been completed, in order to meet changing requirements or to take
care of the errors that shown up. There are four types of maintenance:

5.1 Corrective Maintenance: When the program after compilation


shows error because of some unexpected situations, untested areas such
errors are fixed up by Corrective Maintenance.

5.2 Adaptive Maintenance: Changes in the environment in which


an information system operates may lead to system management. To
accommodate changing need time to time maintenance is done and is
called Adaptive Maintenance.

5.3 Preventive Maintenance: If possible the errors could be


anticipated before they actually occur; the maintenance is called
Preventive Maintenance.

5.4 Perfective Maintenance: In this rapidly growing world,


information technology is the fastest growing area. If the existing system
is maintained to keep tuned with the new features, new facilities, new
capabilities, it is said to be Perfective Maintenance.

MODULES USED

1. The pygame Library: Making the Game Come Alive


7
The pygame library is essential for creating the graphics and handling
player input. It helps us draw shapes (like the paddles and ball), move them
around, and capture key presses for player actions.

2. The random Module: Adding Some Chaos to the Ball's


Movement

To make the game more interesting, we don’t want the ball to always start
in the same direction. The random module helps us give the ball an
unpredictable starting direction each time the game begins or after it scores
a point.

3. The time Module: Managing Game Delays

We use time to handle brief pauses, like when the game resets the ball's
position after a point is scored.

4. The sys Module: Exiting the Game

The sys module helps us manage the game’s exit when the user closes the
window.

5. The math Module: If You Want to Get Fancy

The math module is optional, but it can help if you want to add some more
realistic motion to the ball, like adjusting its speed or trajectory.

8
FLOW CHART
start

Initialize database
Retrieve saved data
Connect to database

Data retrieved
Initialize game successfully
9
Ball,paddle

Draw game screen


Handle error

Check for
input

Move paddles

Update ball position

Collision
detection

wall Paddle

Reverse

Reverse
Score

A
A

Update score
Score+=0

Save score to
database

10

Check winner Continue game


SOURCE CODE
import turtle

import sqlite3

# Set up the database

conn = sqlite3.connect("pong_scores.db")

cursor = conn.cursor()

11
cursor.execute("""

CREATE TABLE IF NOT EXISTS scores (

id INTEGER PRIMARY KEY AUTOINCREMENT,

player_a_score INTEGER,

player_b_score INTEGER

""")

conn.commit()

# Function to save scores to the database

def save_scores_to_db(player_a_score, player_b_score):

cursor.execute("INSERT INTO scores (player_a_score, player_b_score)


VALUES (?, ?)",

(player_a_score, player_b_score))

conn.commit()

# Set up the window

win = turtle.Screen()

win.title("Pong Game")

win.bgcolor("navy")

win.setup(width=800, height=600)

win.tracer(0)
12
# Paddle A

paddle_a = turtle.Turtle()

paddle_a.speed(0)

paddle_a.shape("square")

paddle_a.color("crimson")

paddle_a.shapesize(stretch_wid=6, stretch_len=1)

paddle_a.penup()

paddle_a.goto(-350, 0)

# Paddle B

paddle_b = turtle.Turtle()

paddle_b.speed(0)

paddle_b.shape("square")

paddle_b.color("lime")

paddle_b.shapesize(stretch_wid=6, stretch_len=1)

paddle_b.penup()

paddle_b.goto(350, 0)

# Ball

ball = turtle.Turtle()

13
ball.speed(40)

ball.shape("square")

ball.color("yellow")

ball.penup()

ball.goto(0, 0)

ball.dx = 0.2

ball.dy = -0.2

# Score

score_a = 0

score_b = 0

# Score display

pen = turtle.Turtle()

pen.speed(0)

pen.color("light grey")

pen.penup()

pen.hideturtle()

pen.goto(0, 260)

pen.write("Player A: 0 Player B: 0", align="center", font=("Courier", 24,


"normal"))

14
# Functions to move paddles

def paddle_a_up():

y = paddle_a.ycor()

if y < 250:

y += 20

paddle_a.sety(y)

def paddle_a_down():

y = paddle_a.ycor()

if y > -240:

y -= 20

paddle_a.sety(y)

def paddle_b_up():

y = paddle_b.ycor()

if y < 250:

y += 20

paddle_b.sety(y)

def paddle_b_down():

y = paddle_b.ycor()

15
if y > -240:

y -= 20

paddle_b.sety(y)

# Keyboard bindings

win.listen()

win.onkeypress(paddle_a_up, "w")

win.onkeypress(paddle_a_down, "s")

win.onkeypress(paddle_b_up, "Up")

win.onkeypress(paddle_b_down, "Down")

# Main game loop

while True:

win.update()

# Move the ball

ball.setx(ball.xcor() + ball.dx)

ball.sety(ball.ycor() + ball.dy)

# Border checking

if ball.ycor() > 290:

16
ball.sety(290)

ball.dy *= -1

if ball.ycor() < -290:

ball.sety(-290)

ball.dy *= -1

if ball.xcor() > 390:

ball.goto(0, 0)

ball.dx *= -1

score_a += 1

pen.clear()

pen.write("Player A: {} Player B: {}".format(score_a, score_b),


align="center", font=("Courier", 24, "normal"))

if ball.xcor() < -390:

ball.goto(0, 0)

ball.dx *= -1

score_b += 1

pen.clear()

pen.write("Player A: {} Player B: {}".format(score_a, score_b),


align="center", font=("Courier", 24, "normal"))
17
# Paddle and ball collisions

if (350 > ball.xcor() > 340) and (paddle_b.ycor() + 50 > ball.ycor() >
paddle_b.ycor() - 50):

ball.setx(340)

ball.dx *= -1

if (-350 < ball.xcor() < -340) and (paddle_a.ycor() + 50 > ball.ycor() >
paddle_a.ycor() - 50):

ball.setx(-340)

ball.dx *= -1

# End game condition

if score_a == 5 or score_b == 5:

pen.clear()

winner = "Player A" if score_a == 5 else "Player B"

pen.write("{} Wins!".format(winner), align="center", font=("Courier",


36, "bold"))

save_scores_to_db(score_a, score_b)

break

# Close the database connection

18
conn.close()

19
OUTPUT

20
CONCLUSION

Pong is more than just a simple game; it’s a piece of video game history
that still holds a special place in the hearts of many. First released in 1972,
it was the game that started it all and proved that a basic idea could
capture the imagination of millions. What makes Pong so enduring is its
simplicity and the way it brings people together for friendly competition. It’s
a game that’s easy to learn but hard to master, making it perfect for a quick
play session or hours of back-and-forth matches.

Even with all the advancements in gaming over the decades—high-


definition graphics, complex storylines, and immersive worlds—Pong still
has its charm. It’s a reminder that sometimes, the best games don’t need
fancy graphics or intricate plots. They just need to be fun. Pong is proof that

21
simplicity can be powerful, that a straightforward concept can create
unforgettable moments, and that a game doesn’t have to be complicated to
be loved.

So whether you’re revisiting this classic or experiencing it for the first time,
Pong is sure to bring a smile to your face. It’s a game that embodies the
pure joy of gaming—competitive, nostalgic, and timeless.

BIBLIOGRAPHY

List of sites, docs used for reference:


 YouTuber:
https://www.youtube.com/@CodingWithRuss/featured

List of book, docs used for reference:

 Computer Science with python(class 12)(SUMITA ARORA)

22
23

You might also like