Hand Cricket Game In Python

Thanks for reading my article first. Hand Cricket Game In Python We are going to learn more about this in this article. Let’s go into the article. asks the user for a number of overs to play then keeps track of runs, wickets out, and overs.

That part is OK but I can’t figure how to keep track of each batter and their runs. Only 1 batter can get out at one time and they swap the striker end after each over and obviously for odd runs. Please help if you can. Here is the part of the program so far I just need to add the batters.

Hand Cricket Game In Python

Hand Cricket Game in Python

Example: hand cricket game in python

import random

lst1= [1,2,3,4,5,6,7,8,9,10]

chances_1= 20
no_of_chances_1= 0
your_runs= 0
 
print ("-----------------------------------------------\nYour Batting\n")
while no_of_chances_1 < chances_1:
    
    runs= int(input("Enter Runs for Your Batting Turn: "))
    comp_bowl= random.choice(lst1)

    if runs==comp_bowl:
        print ("Your Guess: ",runs,",Computer Guess: ",comp_bowl)
        print ("You are Out. Your Total Runs= ", your_runs,"\n")
        break
    elif runs>10:
        print ("ALERT!! Support No only till 10\n")
        continue
    else:
        your_runs= your_runs+runs
        print ("Your Guess: ",runs,",Computer Guess: ",comp_bowl)
        print ("Your runs Now are: ",your_runs,"\n")

    no_of_chances_1= no_of_chances_1 + 1  

lst2= [1,2,3,4,5,6,7,8,9,10]

chances_2= 20
no_of_chances_2= 0
comp_runs= 0
print ("-----------------------------------------------")
print ("Computer Batting-\n")
while no_of_chances_2 < chances_2:

    bowl= int(input("Enter Runs for Your Bowling Turn: "))
    comp_bat= random.choice(lst2)

    if comp_bat==bowl:
        print ("Computer Guess: ",comp_bat,"Your Guess: ",bowl)
        print ("The Computer is Out. Computer Runs= ",comp_runs,"\n")
        break
    else:
        comp_runs= comp_runs+comp_bat
        print ("Computer Guess: ",comp_bat,"Your Guess: ",bowl)
        print ("Computer Runs: ",comp_runs,"\n")

        if comp_runs > your_runs:
            break
        
    no_of_chances_2= no_of_chances_2+1


print ("\n-----------------------------------------------\nRESULTS: ")

if comp_runs < your_runs:
    print ("\nYou won the Game.\n\nYour Total Runs= ",your_runs,"  [Bowls taken(Out of 20): ",no_of_chances_1+1,"]","\nComputer Total Runs= ",comp_runs,"  [Bowls Taken(Out of 20): ",no_of_chances_2+1,"]\n")

elif comp_runs == your_runs:
    print ("The Game is a Tie")

else:
    print ("\nComputer won the Game.\n\nComputer Total Runs= ",comp_runs,"  [Bowls Taken(Out of 20): ",no_of_chances_2+1,"]","\nYour Total Runs= ",your_runs,"  [Bowls taken(Out of 20): ",no_of_chances_1+1,"]\n")

If you have ever wondered how multiplayer games are made or just want to create a game for you on the weekend, this is the project for you. In this Python project, you will create a multiplayer Connect 4 game for yourself and your friends using the basics of Pi Game, Sockets, and Game Development.

Raed Also: Python Code for Snake Game

Output

The output will display on the screen using the print() function.

cricker pic

FAQ

What is Python Hand Cricket?

Play hand cricket as an individual or as a team of 11 against a team of 11 bots in the Python command-line interface!

How many players are needed to play Hand Cricket?

Only one player is needed to play Hand Cricket

Can Hand Cricket be played with a real ball?

Hand Cricket is typically played using only the player’s hands and fingers, however, it can be played with a real ball if desired.

How do you score runs in Hand Cricket?

Runs are scored in Hand Cricket by matching the number thrown with the ball with the number played as the shot.

    How to create Hand cricket game in Python | Python | DevIncept

    Final Thoughts

    Hand Cricket is a fun and simple game that can be played by anyone, anywhere. It requires no equipment and can be played alone or with friends. You can try implementing this in Python and customize it according to your needs. Additionally, you can also try adding more complex rules and scoring system to make it more challenging. Hand Cricket Game In Python We hope this article solves all your doubts. If in doubt let me know.

    Hi, I'm Selva a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

    Share on:

    1 thought on “Hand Cricket Game In Python”

    1. I am working over making a hand cricket game using python ,i have completed 80% of the game, waana add some more features to it could you help me.

      Reply

    Leave a Comment