Project Doc
Project Doc
01
INTRODUCTION
02
This project introduces PyCricket, a well-designed
Python program that brings the classic game of
hand cricket into the digital world.
PyCricket offers an easy-to-use platform where
players can dive into a simplified but engaging
version of the traditional game.
By using numbers to represent the gameplay, the
program creates an interactive experience that is
both straightforward and fun.
03
OBJECTIVES OF THE
PROJECT
04
The main goal of this project is to create a Python
program that brings the essence of hand cricket
to life.
05
PROPOSED SYSTEM
06
PyCricket employs a turn-based structure.
07
ABSTRACT
08
This project creates a Python program that brings
the classic game of hand cricket into a digital
space. Players take turns making numerical
guesses to score runs and try to outsmart a
computer opponent, which adds an element of
strategy and unpredictability.
09
HARDWARE &
SOFTWARE
REQUIREMENTS
10
Hardware: A standard personal computer (PC) or
laptop with sufficient memory (RAM) is required.
Minimal storage space is necessary for the
Python interpreter and program itself.
11
SOURCE CODE
12
1 import random
3 while True:
4 try:
5 num = int(input())
7 return num
8 else:
10 except ValueError:
14 total = 0
15 while True:
16 pnum = input_num(1, 6)
17 cnum = random.randint(1, 6)
20 if pnum == cnum:
22 return total
23 else:
13
25 print(batsman + " score is", total)
27 return total
29 print("\nTime for the toss. Enter 0 for Heads and 1 for Tails:")
30 choice = input_num(0, 1)
31 coin = random.randint(0, 1)
32 player_bowls = False
33 if coin == choice:
36 player_bowls = input_num(0, 1) == 1
37 if player_bowls:
39 else:
41 else:
43 player_bowls = random.randint(0, 1) == 1
44 if player_bowls:
46 else:
48 if player_bowls:
14
50 print("\nYou need to score at least", opponent_score + 1, "runs to win.")
52 else:
56 print("\nMatch Results:")
60 print("User wins!")
63 else:
64 print("Match drawn!")
15
SCREENSHOTS
16
17
CONCLUSION
18
This project is a hands-on example of various
Python concepts and techniques we've learned
throughout the course. Developing PyCricket
involves applying key programming principles like
user-defined functions to keep the code
organized and readable.
19
BIBLIOGRAPHY
20
• Computer Science with Python (XII) – Sumita
Arora (TEXT BOOK)
• Reference website:
https://www.geeksforgeeks.org
21