Skip to content

A Python-based cricket match simulator that provides a detailed, over-by-over simulation of T20/limited overs cricket matches with realistic gameplay mechanics and statistics tracking.

Notifications You must be signed in to change notification settings

akshdeepsingh7/cricket-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Cricket Match Simulator 🏏

Python Last Commit Status CodeSize

A sophisticated cricket match simulator built in Python that brings the excitement of cricket to your terminal. Experience realistic match progression, detailed player statistics, and dynamic gameplay mechanics.

📋 Features

Features

  • 🎯 Complete match simulation with two innings
  • 📊 Realistic player stats and performance modeling
  • 🏟️ Multiple field setting options
  • ⚡ Powerplay implementation
  • 📝 Ball-by-ball commentary
  • 💾 Match statistics export (JSON/CSV)
  • 🎮 Various batting shots and bowling styles

🚀 Quick Start

from cricket_simulator import play_match

# Define team data
team1_data = [
    {"name": "Player1", "batting": 85, "bowling": 30, "role": "Batsman"},
    # Add more players...
]

# Start match
play_match(team1_data, team2_data, overs=20)

🏗️ Installation

Setup

git clone https://github.com/akshdeepsingh7/cricket-simulator.git
cd cricket-simulator
python main.py

🎮 Game Mechanics

Player Stats

Stats

  • Batting Skill: 1-100
  • Bowling Skill: 1-100
  • Roles:
    • Batsman
    • Bowler
    • All-rounder

Field Settings

Settings

  • 🛡️ Defensive
  • ⚔️ Attacking
  • ⚖️ Balanced

📊 Data Export

Export

JSON Format

{
    "match_id": "20241129_121530",
    "toss_winner": "Team 1",
    "result": "Team 1 wins by 25 runs"
}

CSV Format

Match ID,Innings,Team,Player,Runs,Balls,Strike Rate
20241129_121530,first_innings,Team 1,Player1,45,30,150.0

🎯 Shot Types

Shots

  • 🛡️ Defensive Block
  • 🚀 Cover Drive
  • ⚡ Square Cut
  • 💥 Pull Shot
  • ➡️ Straight Drive
  • 🌟 Lofted Shot
  • 📐 Edge

🎳 Bowling Types

Bowling

  • ⚡ Fast Pace
  • 🎯 Yorker
  • 💨 Bouncer
  • 🌀 Off Spin
  • 🔄 Leg Spin

🛠️ Requirements

Requirements

  • Python 3.6+
  • Standard Library Only

✨ Acknowledgments

  • 🏏 International Cricket Council for game rules
  • 🎮 Cricket gaming community

Made with Python GitHub issues GitHub stars

About

A Python-based cricket match simulator that provides a detailed, over-by-over simulation of T20/limited overs cricket matches with realistic gameplay mechanics and statistics tracking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages