How to make a cricket game using python only(BEGINNER'S LEVEL)
Hey guys once again welcome to the Decoders blog, I hope you all are doing well and today I'm present with another astonishing game(using PYTHON). The given code will help you to built it, so just follow the codes and make your cricket game easily , and enjoy it with your friends
import random
import time
print("welcome to cricket game")
time.sleep(1)
print("***rules of the game are similar to that of a cricket game***")
time.sleep(3)
print("***different batting styles***:\n1=cover drive\n2=pull shot\n3=upper cut\n4=
sweep\n5=square drive\n6=helicopter shot\n7=reverse sweep\n8=scoop\n9=glance\n10=
defensive shot")
time.sleep(4)
print("***different bowling styles***:\n1=in-swing\n2=out-swing\n3=googly\n4=in-
cutter\n5=out-cutter \n6=off-spin\n7=leg-spin\n8=slower\n9=bouncer\n10=dusra")
time.sleep(4)
list1=[1,2,3,4,5,6,7,8,9,10]
a=0
"""toss between the teams """
list=["stone","paper","scissor"]
_ai_=random.choice(list)
_you_=input("***READY FOR TOSS***\n choose from stone,paper,scissor:\n")
if _you_==_ai_:
print(_ai_)
time.sleep(1)
print("***GO HOME,I THINK ITS NOT THE RIGHT DAY FOR YOU TO PLAY***")
elif _you_=="stone" and _ai_=="paper":
print(_ai_)
print("you loose the toss")
print("you are going to bowl first")
number=a
while(True):
n1=int(input("enter the bowling style: "))
a=random.choice(list1)
if a!=n1:
print("opponents batting style:",a)
a=a+number
print("***RUNS***:",a)
else:
print("opponents batting style:",a)
print("GAME OVER, your target is:",number)
break
number=a
elif _you_=="stone" and _ai_=="scissor":
print(_ai_)
print("you won the toss")
print("you are going to bat first")
number=a
while(True):
n1=int(input("enter the batting style:"))
a=random.choice(list1)
if a!=n1:
print("opponents bowling style:",a)
n1=n1+number
print("***RUNS***:",n1)
else:
print("opponents batting style:",a)
print("GAME OVER, you have to defend a total of:",number)
break
number=n1
elif _you_=="paper" and _ai_=="stone":
print(_ai_)
print("you won the toss")
print("you are going to bat first")
number=a
while(True):
n1=int(input("enter the batting style:"))
a=random.choice(list1)
if a!=n1:
print("opponents bowling style:",a)
n1=n1+number
print("***RUNS***:",n1)
else:
print("opponents batting style:",a)
print("GAME OVER, you have to defend a total of:",number)
break
number=n1
elif _you_=="paper" and _ai_=="scissor":
print(_ai_)
print("you loose the toss")
print("you are going to bowl first")
number=a
while(True):
n1=int(input("enter the bowling style:"))
a=random.choice(list1)
if a!=n1:
print("opponents batting style:",a)
a=a+number
print("***RUNS***:",a)
else:
print("opponents batting style:",a)
print("GAME OVER, your target is:",number)
break
number=n1
elif _you_=="scissor" and _ai_=="paper":
print(_ai_)
print("you won the toss")
print("you are going to bat first")
number=a
while(True):
n1=int(input("enter the batting style:"))
a=random.choice(list1)
if a!=n1:
print("opponents bowling style:",a)
n1=n1+number
print("***RUNS***:",n1)
else:
print("opponents batting style:",a)
print("GAME OVER, you have to defend a total of:",number)
break
number=n1
elif _you_=="scissor" and _ai_=="stone":
print(_ai_)
print("you loose the toss")
print("you are going to bowl first")
number=a
while(True):
n1=int(input("enter the bowling style:"))
a=random.choice(list1)
if a!=n1:
print("opponents batting style:",a)
a=a+number
print("***RUNS***:",a)
else:
print("opponents batting style:",a)
print("GAME OVER, your target is:",number)
break
number=a
Comments
Post a Comment