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

Project PDF (RAHUL)

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

Project PDF (RAHUL)

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

Arcade Cricket Game

AISSCE- All India Senior Certificate


Examination

2023-24: Science – XII A

In
Computer Science (083)

By:
1.Rahul Rakesh Narain – XII A – Roll No:
2.Vaibhav – XII A – Roll No:
3.Suryansh Tiwari – XII A – Roll No:
4.Prashant Kumar – XII A – Roll No:

KENDRIYA VIDYALAYA ANDREWS GANJ


CERTIFICATE
This is to certify that
Rahul Rakesh Narain
Vaibhav
Suryansh Tiwari
Prashant Kumar

have successfully completed this project report


entitled “Arcade Cricket Game” During the
academic year 2023-2024 towards partial
fulfilment of Computer Science Practical
Examination conducted by CBSE.

---------------- ----------------
Teacher’s Principal’s
signature signature

----------------
Examiner’s
signature
ACKNOWLEDGEMENT

We take this opportunity to express


our profound gratitude and deep
regards to our subject teacher for his
exemplary guidance, monitoring and
constant encouragement throughout the
course of this project. The blessing, help
and guidance given by him time to shall
carry us a long way in the journey of life
on which we are about to embark.

- Rahul Rakesh Narain, Vaibhav, Suryansh Tiwari


& Prashant Kumar
DECLARATION
I hereby declare that the project work entitled:

“Arcade Cricket Game”


is prepared by us,

Rahul Rakesh Narain,


Vaibhav ,
Suryansh Tiwari
Prashant Kumar

under the supervision of our subject teacher for


the partial fulfilment of All India Senior
Secondary Certificate Examination (AISSCE)
Contents
1. Introduction of the Project.

2. System Requirements of the Project.

3. Python Coding.

4. Output of the Project.

5. References.
INTRODUCTION
This project introduces a fun vs computer cricket
game. In this game we have setted up the
computer to ball and the user will be batting to
score the highest possible runs to make it to the
top of the leader board against other users.

In this project various functions and modules


were used which are mentioned in requirements
section which are required for the game to run.
Without these functions, game will not work
properly.

This game is extremely user friendly as far as our


knowledge and we have tried to simply break it
down for user if they feel stuck at any part
through “how to play” option in the game.

System Requirements of
the Project
Recommended System Requirements
Processors:
Intel® Core™ i3 processor 4300M at 2.60 GHz.
Disk space: 2 to 4 GB. Operating systems:
Windows® 10, MACOS, and UBUNTU. Python
Versions: 3.X.X or Higher. Minimum System

Requirements Processors:
Intel Atom® processor or Intel® Core™ i3
processor. Disk space: 1 GB. Operating systems:
Windows 7 or later, MACOS, and UBUNTU.
Python Versions: 2.7.X, 3.6.X.

Python Modules Required:


“mysqlconnector”
To establish connection between python and
respective SQL database.
“Random module”
To let computer choose any random number
between the range of 1 to 6.

“Easygui”
For a user friendly interactive and attractive
dialogue box generation for secure and easy login
into the game.

Prerequisites before installing MySQL


Connector Python:
You need root or administrator privileges to
perform the installation process. Python must be
installed on your machine.
Note: MySQL Connector Python requires python
to be in the system’s PATH. Installation fails if it
doesn’t find Python. On Windows, If Python
doesn’t exist in the system’s PATH, please
manually add the directory containing python.exe
yourself.

PYTHON CODING
import mysql.connector as ms
import random
def getuname():

import easygui
return easygui.enterbox("Enter your
username")

def getpass():

import easygui
return easygui.passwordbox()

def upscore(user,score):

cur.execute(f"update lb set score={score} where


username='{user}';")
c.commit()

def inputscore(user,score):

cur.execute(f"insert into lb
values('{user}','{score}');")
c.commit()

while True:

c=ms.connect(host="localhost",user="root",passw
ord="sql1234",database="project")
cur=c.cursor()
print('''
========================
MENU
========================

1.Login
2.Register
3.Leaderboard
4.How to play
5.Quit

''')
ch=int(input("Enter your choice:"))

if ch==1:
un=getuname()
cur.execute("select username from login")
x=cur.fetchall()
l=[]
for a in x:
for st in range(0,1):
l.append(a[st])

if un in l:
up=getpass()
p=str(up)
cur.execute(f"select pass from login where
username like '{un}'")
y=cur.fetchall()
for b in y:
if p in b:
print("Logged in successfully.")
wic=3
sco=0
ba=18
while wic > 0 and ba > 0:
pc=int(input("Runs score on this
ball(1-6):"))
cc=random.randrange(1,7)
print(cc)
if cc==pc or pc>=7:
print("You lost a wicket.")
wic=wic-1
else:
sco=sco+pc
ba=ba-1
print(f"Balls remaining:{ba}")
print("Your score this game is:",sco)
cur.execute(f"select username from
lb")
us=cur.fetchall()
ls=[]
for search in us:
for ssearch in range(0,1):
ls.append(search[ssearch])
if un in ls:
upscore(un,sco)
else:
inputscore(un,sco)

else:
print("Password incorrect.")
else:
print("Username incorrect or not found.")

if ch==2:
n=getuname()
p=getpass()
cur.execute("select pass from login")
o=cur.fetchall()
for g in o:
if p in g:
print("Password already taken.")
print("Re-run the game to register again
with a different password.")
break
else:
cur.execute(f"Insert into login
values('{n}','{p}')")
print("Account created successfully. ")
print("Re-run the game and login to
play.")
c.commit()
break
break
if ch==3:
cur.execute("select * from lb order by score
desc")
u=cur.fetchall()
for b in u:
print(b)

if ch==4:
print('''
******REGISTER OR LOGIN TO PLAY*******

***RULES***

▸You are batting against computer


▸You have 2 wickets
▸Select any number from 1-6 in order to
score runs,
if you chose a number that is not in this
range then you
will lose a wicket
▸The computer will aslo select a random
number from 1-6
▸If both the numbers selected by you and
computer is same you
will loose a wicket
▸2 wickets and the game is over
▸Check leaderboards to see all time scores

''')
if ch==5:
print('''
*************************
Quitting the game
*************************

''')
break

Output of the Project


Finally, we conclude our work and present the output
of the Project.
MAIN SCREEN

USER AUTHENTICATION
LEADERBOARD
HOW TO PLAY
References
1. python.org

2. LearnPython.org

3.Github.com

4.Sumita Arora Computer Science With Pythons

You might also like