Play hand cricket as an individual or as a team of 11 against a team of 11 bots for free on the Python Command Line Interface! More information about the gameplay is available in the documentation.
NOTE: The gameplay charts in the documentation are still relevant, but the instructions no longer work. Instead, directly run main.py for the full gameplay.
This is a hybrid of cricket and the legacy hand cricket game – implemented in Python and played using the command line interface.
This game is compatible with all releases of Python 3.6 and later.
The game can be played even without an internet connection.
Tournament mode is not yet included in this game. Customized tournaments can be created using individual team files. For such tournaments, at least 20 MB of disk space is recommended.
Test cricket is fully supported.
This game supports almost all of the laws of cricket which can be implemented in a computer program.
NOTE: To play only the traditional hand cricket game, play a limited overs game, and set a large number of overs (For example, 1000 overs) and 1 wicket as the game settings when prompted.
The source code is located in the src directory. The main source code with all the functions uses a class-based approach. The classes can be viewed here
The source code comprises of the following modules:
- Team setup: Setup your team and it's members. Team members need not be unique, since only one person may actually be an entire team, i.e., the person wants to play as an individual. In that case, the person's name can be the name of each team member.
- Match registration: Register a match between your team and another team. To play against the computer, simply skip the play human option.
- The game: This module can handle both limited-overs and test cricket.
- src/modules/batterchoice.py: From a given list of players, select the player who will bat now.
- src/modules/batting.py: Module which contains the code for batting.
- src/modules/bowlerchoice.py: From a given list of players, select the bowler.
- src/modules/bowling.py: Module which contains the code for bowling.
- src/modules/scoreinput.py: This module contains the code to play each ball by using the batting and bowling modules.
- src/modules/commentary.py: Generate the commentary for each ball bowled, based on the result of that ball.
- src/modules/scorecard.py: Generate the innings scorecard at the end of each innings.
- src/modules/superover.py: The super over tiebreaker.
- src/modules/hashfunc.py: Contains the hashing and verification algorithms used, by importing the required modules. Therefore, if a stronger algorithm is found, it is easier to simply update the algorithm from this file than to update the algorithms everywhere.
- src/modules/toss.py: Toss to decide which team bats / fields first. This code is not compatible with super over games, since this decision is the reverse of their decision in the latest tied game
- src/modules/followon.py: Only works for test cricket. Determine whether the team which batted first can enforce the follow-on or not. This code runs only if the team batting first leads by a certain threshold.
- src/modules/savegamedata.py: Saves the completed game into a JSON file.
Some folders (directories) have a README.md file. Please read them carefully as they describe the contents of that directory.
This game is a hybrid of cricket and hand cricket and runs on the Python Command-line interface.
- To know more about hand cricket, visit https://www.instructables.com/id/How-to-Play-Hand-Cricket/
- To know more about the laws of cricket, visit https://en.wikipedia.org/wiki/Laws_of_Cricket
NOTE: The scoring and dismissal mechanisms are determined by the rules of Hand Cricket. The rest of the game follows the Laws of Cricket
The ultimate goal is simple: Score more than your opponent to win.
To play this game, you need to have Python software installed. Go to https://www.python.org/downloads to install the latest version.
Supported platforms:
Either download this entire repository to play this game, or clone this repository using:
$ git clone https://github.com/BurraAbhishek/Python-Hand-Cricket.git
Disk space: 32 MB (minimum), 256 MB or more (recommended).
- Run out: The batter fails to reach the crease before the wickets fall.
- Extras: Wides, no balls, byes, leg-byes.
- This game implements a 6-run penalty for wrong bowling input. In actual cricket, various infractions by the fielding side can lead to 5 penalty runs.
- Rain delay and DLS par score
Rain delay and abandoned matches are not yet implemented in this game. However, deliberately closing the application in order to avoid losing a match is considered as an abandoned match. This issue can't be fixed, since there are other ways to get around it, for example, by manually editing the JSON team files.
The source code is licensed under the terms of the MIT License, unless specified otherwise.
The sample games and documentation are licensed under the Creative Commons CC0 license.