A library for cricket scoring logic.
Project description
Cricket Scoring Library
A Python library for managing cricket scoring logic. This library provides utility functions for updating batting stats, bowling stats, and switching batting teams.
Features
- Update batting statistics (runs, balls, boundaries, dismissals).
- Update bowling statistics (runs conceded, wickets, overs bowled).
- Switch batting teams during a match.
Installation
Install the library via pip:
pip install cricket-scoring
Usage
Updating Batting Stats
from cricket_scoring.batting import update_batting_stats
player_stats = {
'runs': 10,
'balls': 5,
'fours': 1,
'sixes': 0,
'is_out': False
}
updated_stats = update_batting_stats(player_stats, runs=4, balls=1, is_out=False, is_four=True, is_six=False)
print(updated_stats)
Updating Bowling Stats
from cricket_scoring.bowling import update_bowling_stats
bowler_stats = {
'runs_conceded': 20,
'balls_bowled': 12,
'wickets': 1,
'overs': 2.0
}
updated_stats = update_bowling_stats(bowler_stats, runs=4, balls=1, is_wicket=False)
print(updated_stats)
Switching Batting Teams
from cricket_scoring.match import switch_batting_team
current_team = "Team A"
team1 = "Team A"
team2 = "Team B"
new_batting_team = switch_batting_team(current_team, team1, team2)
print(new_batting_team)
Development
Running Tests
Install pytest:
pip install pytest
Run tests:
pytest tests/
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cricket_scoring-1.0.1.tar.gz.
File metadata
- Download URL: cricket_scoring-1.0.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60b1cc9f07dabf02401836e51fb35263a8344d5214b0f5477d45bf62e8b6b67c
|
|
| MD5 |
0949c5df133d8232841f23bfc3b2a285
|
|
| BLAKE2b-256 |
3c7cd98702f7c6890e7c37244c7eced0b924474a1fffc6404883ac374be2dca4
|
File details
Details for the file cricket_scoring-1.0.1-py3-none-any.whl.
File metadata
- Download URL: cricket_scoring-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90879cfa76cb5e40389c662a49d664a60270840261f767d77c716b0fb7d0119c
|
|
| MD5 |
6b33d47154c663fb292f0e1533a025b6
|
|
| BLAKE2b-256 |
2190832febfe68dea7ee0a0fb377fe4c613c4ac1fa6982ce3d38093b1e66a60c
|