This is a Python-based T20 match simulator that generates a configurable number of matches between India and New Zealand. Player performances, match outcomes, and other match data are randomly simulated with reasonable constraints.
π Project Structure (click to expand)
cricket_match_simulator/ β βββ config/ # π External configurations (editable JSON files) β βββ teams.json # π₯ List of players for India and New Zealand β βββ venues.json # ποΈ List of possible match venues β βββ umpires.json # π§ββοΈ List of available umpires β βββ config_loader.py # π§ Module to load data from config JSON files βββ match_generator.py # π² Core logic to simulate one T20 match βββ series_generator.py # π Logic to generate and save multiple matches βββ main.py # π Entry script to trigger the simulation β βββ output/ # π¦ Auto-created directory to store the JSON results
All match details are driven by JSON files inside the config/ directory. You can modify them without touching the code.
Define teams and make sure each team has at least 11 players.
Define match venues.
Define umpires list.
Make sure you have Python installed:
python --version
Navigate to the project directory and run:
python main.py
This will:
* Simulate 4545 matches between India and New Zealand
* Save the output to: output/india_vs_newzealand_t20_series_large.json
To simulate a different number of matches, edit main.py:
series_data = generate_series(50) # Simulate 50 matches instead of 4545
Each match entry includes:
{
"match_id": "T20_IND_New Zealand_20240501_1",
"date": "2024-05-01",
"venue": "Mumbai",
"match_type": "T20",
"umpires": ["Nitin Menon", "Aleem Dar"],
"team1": "India",
"team2": "New Zealand",
"team1_score": {"total_runs": 173},
"team2_score": {"total_runs": 159},
"toss_winner": "India",
"toss_decision": "bat",
"winner": "India",
"player_of_match": "Virat Kohli",
"scorecard": [...]
}