Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 27

K.G.

DHOLAKIYA SCHOOL

ACADEMIC YEAR: 2021-22

PROJECT REPORT ON

CRICKET GAME

ROLL NO :

NAME : KUSHAL MODI

CLASS : XII

SUBJECT : COMPUTER SCIENCE

SUB CODE : 083

PROJECT GUIDE: MS. MADHURI CHAUHAN

PGT (CS)

DHOLAKIYA SCHOOL

1
DHOLAKIYA SCHOOL, RAJKOT

CERTIFICATE

This is to certify that Kushal M. Modi CBSE Roll No:

has successfully completed the project work entitled “CRICKET GAME” in the

subject Computer Science (083) laid down in the regulations of CBSE for the purpose of

Practical Examination in Class XII to be held in Dholakiya School, Rajkot on .

(Ms. Madhuri Chauhan)

Signature:

Examiner:

Name:

Signature:

2
TABLE OF CONTENTS [ T O C ]

SER DESCRIPTION PAGE NO

01 ACKNOWLEDGEMENT 04

02 INTRODUCTION OF PYTHON 05-06

03 INFORMATION ABOUT CRICKET 07-09

04 SOURCE CODE 10-18

05 OUTPUT 19-24

06 HARDWARE AND SOFTWARE REQUIREMENTS 25

07 BIBILIOGRAPHY 26

3
ACKNOWLEDGEMENT

Apart from the efforts of me, the success of any project depends largely on the
encouragement and guidelines of many others. I take this opportunity to express my gratitude to
the people who have been instrumental in the successful completion of this project.

I express deep sense of gratitude to almighty God for giving me strength for the
successful completion of the project.

I express my heartfelt gratitude to my parents for constant encouragement while carrying


out this project.

I gratefully acknowledge the contribution of the individuals who contributed in bringing


this project up to this level, who continues to look after me despite my flaws.

My sincere thanks to Ms.Madhuri Chauhan Master In-charge, a guide, who critically


reviewed my project and helped in solving each and every problem, occurred during
implementation of the project

The guidance and support received from all the members who contributed and who are
contributing to this project, was vital for the success of the project. I am grateful for their
constant support and help.

4
WHAT IS PYTHON?
Python is a popular programming language. It was created by Guido van
Rossum, and released in 1991.

It is used for:

 web development (server-side),


 software development,
 mathematics,
 system scripting.

WHAT CAN PYTHON DO?


 Python can be used on a server to create web applications.
 Python can be used alongside software to create workflows.
 Python can connect to database systems. It can also read and modify files.
 Python can be used to handle big data and perform complex
mathematics.
 Python can be used for rapid prototyping, or for production-ready
software development.

5
WHY PYTHON?
 Python works on different platforms (Windows, Mac, Linux,
Raspberry Pi, etc).
 Python has a simple syntax similar to the English language.
 Python has syntax that allows developers to write programs with fewer
lines than some other programming languages.
 Python runs on an interpreter system, meaning that code can be executed as
soon as it is written. This means that prototyping can be very quick.
 Python can be treated in a procedural way, an object-oriented way or a
functional way.

GOOD TO KNOW
 The most recent major version of Python is Python 3, which we shall be
using in this tutorial. However, Python 2, although not being updated with
anything other than security updates, is still quite popular.
 In this tutorial Python will be written in a text editor. It is possible to write
Python in an Integrated Development Environment, such as Thonny,
Pycharm, Netbeans or Eclipse which are particularly useful when
managing larger collections of Python files.

PYTHON SYNTAX COMPARED TO OTHER PROGRAMMING


LANGUAGES

 Python was designed for readability, and has some similarities to the
English language with influence from mathematics.
 Python uses new lines to complete a command, as opposed to other
programming languages which often use semicolons or parentheses.
 Python relies on indentation, using whitespace, to define scope; such as the
scope of loops, functions and classes. Other programming languages often
use curly-brackets for this purpose.

6
What is Cricket?
Cricket is a bat and ball game played between two teams, 11 players each, on a
field which has a rectangular 22-yard-long pitch in the centre. The game is played
by 120 million players world-wide making it the second most popular sport in the
world. The purpose of the game is to score more runs than your opposing team.

A Cricket match is divided into periods called innings. It is decided before the
game begins, if both teams will have one or two innings. During the innings one
team bats while the other fields. All 11 players on the fielding team are on the
pitch at the same time however only two batsmen are the field at any one time.

Team captains toss a coin to decide who should bat first.

Cricket fields tend to be oval in shape. The end which is marked off is called
the boundary, with the rectangle “pitch” in the centre.

At each end of the pitch are the wickets, 22 yards apart. A bowling crease is in
line with the wicket and the batting or popping crease is 4ft in front of the wicket.

7
Jargon buster
Batsman – individual who is batting. Attempting to bat away the ball with
being made out.

Bowler – an individual who is bowling, attempting to bowl out the batsman.

Fielder – an individual attempting to catch the ball without it bouncing to dismiss


the batsman, also to return the ball as quick as possible to prevent the batsman
gaining runs.

Run – when a batsman completes a run from one crease to another, without
fielders knocking off stumps.

Wickets/stumps – 3 vertical stumps, supporting 2 small horizontal stumps.

Crease – a bowler cannot deliver the ball beyond the bowling crease. A
batman’s must be inside the batting crease before a fielder knocks off his
stumps.

Wicket keeper (one of the fielding team) is positioned directly behind the
wicket.

LBW leg before wicket – when the batsman prevents the ball hitting the wicket
with his leg. Umpire – 2 umpires regulate the match referee. One behind the
wicket at the bowling end and the other at square leg.

Square leg – 15-20 meters outside the on strike batsman.

Run out – when the batsman is outside the wicket he owns, outside his crease
when fielding team remove stump/s

Over – 6 consecutive bowls from the bowler.

8
Who is cricket for?

Men, woman, children and seniors can play cricket. If you are looking for a place
to start your child playing cricket, then Check fit will provide you with some
information as a first point of contact.

A lot of senior schools have after-school cricket clubs and there are many other
ways to get you playing the game.

If you are interested in playing women's or girls' cricket, then Check Fit will be
able to provide information on potential clubs in your area.

9
Source code

# Cricket Game

print(""" ~~~~~~~~~~ Game of Cricket ~~~~~~~~~~

Instructions:

1. You have to select any random number from 1 to 6.

2. The computer will also select a number.

3. While batting, if the number selected by you and computer is different, then
your number will add to your runs.

If the number selected by you and computer is same, then you will lose your
wicket.

4. While bowling, if the number selected by you and computer is different, then
the computer's number will add to its runs.

If the number selected by you and computer is same, then the computer will
lose its wicket.

5. Each player will get 2 wickets and 2 overs (12 balls) for batting and
bowling.

6. The innings will end after either the three wickets fell or the overs end.

7. The player with maximum runs wins. """)

print("\n---------- Start Game------------")

10
import random

# Toss

print("\nHere comes the Toss")

toss = (input("Choose heads or tails: ")).lower()

random_toss = random.randint(1,2) # In random_toss (1 = Heads)


and (2 = Tails)

random_opt = random.randint(1,2) # In random_opt (1 = bat) and (2


= ball)

u_opt = 0

c_opt = 0

if random_toss == 1 and toss == "heads":

print("\nYou won the toss")

u_opt = (input("Choose bat or ball: ")).lower()

elif random_toss == 2 and toss == "tails":

print("\nYou won the toss")

u_opt = (input("Choose bat or ball: ")).lower()

11
else:

print("\nYou lost the toss")

if random_opt == 1:

c_opt = "bat"

print("Computer choose to",c_opt)

elif random_opt == 2:

c_opt = "ball"

print("Computer choose to",c_opt)

# First Innings

print("\n---------- First Innings Begins------------")

runs_1 = 0

wickets_1 = 0

balls_1 = 0

while wickets_1 != 2 and balls_1 != 12:

u_choice = int(input("\nChoose any number from 1 to 6: "))

12
c_choice = random.randint(1,6)

if u_choice < 1 or u_choice > 6: print("\nPlease

choose a value from 1 to 6.")

else:

print("Your choice: ",u_choice,"\nComputer's choice: ",c_choice)

if u_choice == c_choice:

wickets_1 += 1

else:

if u_opt == "bat" or c_opt == "ball":

Bat_first = "You"

Ball_first = "Computer"

runs_1 += u_choice

elif u_opt == "ball" or c_opt == "bat":

Bat_first = "Computer"

Ball_first = "You"

runs_1 += c_choice

print("\nScore =",runs_1,"/",wickets_1)

13
balls_1 += 1

if balls_1 == 6:

print("End of Over 1")

elif balls_1 == 12:

print("End of Over 2")

print("Balls remaining: ",12 - balls_1)

print("\n---------- End of Innings------------")

print("\nFinal Score:")

print("Runs =",runs_1)

print("wickets =",wickets_1)

print("\n",Ball_first,"needs",runs_1 + 1,"runs to win.")

# Second Innings

print("\n---------- Second Innings Begins--------------")

14
runs_2 = 0

wickets_2 = 0

balls_2 = 0

while wickets_2 != 2 and balls_2 != 12 and runs_2 <= runs_1:

u_choice = int(input("\nChoose any number from 1 to 6: "))

c_choice = random.randint(1,6)

if u_choice < 1 or u_choice > 6: print("\nPlease

choose a value from 1 to 6.")

else:

print("Your choice: ",u_choice,"\nComputer's choice: ",c_choice)

if u_choice == c_choice:

wickets_2 += 1

else:

if Bat_first == "Computer":

runs_2 += u_choice

Bat_second = "You"

15
elif Bat_first == "You": runs_2

+= c_choice Bat_second =

"Computer"

print("\nScore =",runs_2,"/",wickets_2)

balls_2 += 1

if balls_2 == 6:

print("End of Over 1")

elif balls_2 == 12:

print("End of Over 2")

if runs_2 <= runs_1 and balls_2 <= 11 and wickets_2 != 2: print("To

win:",runs_1 - runs_2 + 1,"runs needed from",12 -


balls_2,"balls.")

print("\n---------- End of Innings------------")

print("\nFinal Score:")

print("Runs =",runs_2)

print("wickets =",wickets_2)

16
# Result of Match

print("\n~~~~~~~~~~ Result ~~~~~~~~~~")

if runs_1 > runs_2:

if Bat_first == "You":

print("\nCongratulations! You won the Match by",runs_1 -


runs_2,"runs.")

else:

print("\nBetter luck next time! The Computer won the Match


by",runs_1 - runs_2,"runs.")

elif runs_2 > runs_1:

if Bat_second == "You":

print("\nCongratulations! You won the Match by",2 -


wickets_2,"wickets.")

else:

print("\nBetter luck next time! The Computer won the Match by",2 -
wickets_2,"wickets.")

17
else:

print("The Match is a Tie.","\nNo one Wins.")

18
Output

19
20
21
22
23
24
HARDWARE AND SOFTWARE REQUIREMENTS

I.OPERATING SYSTEM : WINDOWS 7 AND ABOVE

II. PROCESSOR : PENTIUM (ANY) OR AMD

ATHALON (3800+- 4200+

DUALCORE)

III. MOTHERBOARD : 1.845 OR 915,995 FOR PENTIUM

K9MM-V VIAK8M800+8237R

PLUS CHIPSET FOR AMD

ATHALON

IV. RAM : 512MB+

V. Hard disk : SATA 40 GB OR ABOVE

VI. CD/DVD r/w multi drive combo: (If back up required)

VII. FLOPPY DRIVE 1.44 MB : (If Backup required)

VIII. MONITOR 14.1 or 15 -17 inch

IX. Key board and mouse

X. Printer : (if print is required – [Hard copy])

SOFTWARE REQUIREMENTS:
I. Windows OS
II. Python

25
BIBLIOGRAPHY

1. Computer science With Python - Class XI&XII By : SumitaArora


2. A Project Report On Cricket Game
By: Kushal Modi
3. Website: https://www.youtube.com

26
THANK
YOU!!!

27

You might also like