zen-cricket

byJohn Pennington

Create a Test cricket match simulator inspired by Syedur Rahman's classic cricket simulator from the early 2000s, featuring: Core Requirements Match Structure Full 5-day Test match simulation Two innings per team Overs bowled in groups of 6 balls Realistic session structure (90 overs per day: 30-30-30 split across three sessions) Follow-on rules (200+ run lead) Declaration option available to batting team Draw, win by innings, or win by runs/wickets outcomes Visual Style & Feel Text-based interface with ASCII art elements Scoreboard display showing: current score, wickets, overs, run rate, partnership Ball-by-ball commentary in classic style ("Short of a length, defended", "Full toss, SMASHED for SIX!") Match situation summary at end of each over Fall of wickets display Bowling figures table Batting scorecard with detailed statistics Batting Mechanics (Modern Scoring Rates) Test match run rates reflecting modern aggressive approach (3.2-3.8 runs per over typical) Batsman attributes: Left/Right Hand Bat, Keeper (Y/N), Average (1-99), Strike Rate (10-150) Shot types: defensive, attacking, risky Confidence system that builds with runs scored and drops after dot balls Partnerships that accelerate as both batsmen settle New batsmen start cautiously (first 20 balls have reduced scoring) Tail-enders (batting position 9-11) with significantly reduced abilities Higher boundary percentage than historical simulators (30-40% of runs from boundaries) Bowling Mechanics with Fatigue System Bowler attributes: Hand: Right/Left, Type (Fast/Fast-Medium/Medium-Fast/Medium/Leg-Spin/Off-Spin), Average (20-150), Strike-Rate (20-200) Realistic spell lengths: Fast bowlers: maximum 6-8 over spells before requiring rest Fast-medium: 8-10 over spells Spinners: 12-20 over spells (can bowl longer) Fatigue effects: Effectiveness drops 5% per over in spell after optimal length Bowling speed reduces for pace bowlers when tired Accuracy decreases (more loose deliveries) Increased chance of being hit for boundaries Rest and recovery: Bowlers need minimum 8-12 overs rest between spells Stamina recovers 20% per 10 overs rested Between innings: full recovery Overnight: full recovery Bowling styles affect wicket-taking: pace early/late, spin middle sessions Reverse swing possible after 40 overs with old ball New ball available every 80 overs with increased effectiveness Match Conditions Pitch conditions: green (seam-friendly), flat (batting paradise), dusty (spin-friendly), cracked (variable bounce) Pitch deteriorates over 5 days (favors spin and unpredictable bounce on day 4-5) Weather effects: overcast (swing), sunny (batting easier), wind (affects bowling) Session-by-session condition changes Team Management User can control one team or select both teams and let AI control both, User selects 11 players from squad of at least 15, maximum 20 Balanced team composition required (realistic mix of batsmen, all-rounders, bowlers, keeper) Bowling changes controlled by user if user in control, otherwise AI does this Declaration decisions Field settings affect run rate and wicket chances (attacking/defensive) AI Behavior Opposition makes realistic decisions on bowling changes Declares when lead is 400+ and time remaining Adjusts field based on match situation Rotates bowlers considering fatigue Aggressive batting if chasing or setting target Statistical Tracking Individual innings scores with strike rates Bowling figures (overs, maidens, runs, wickets) Partnership details Ball-by-ball log reviewable Match result summary with player of the match Implementation Style Build this as a single-file web application using vanilla HTML/CSS/JavaScript that captures the nostalgic, methodical feel of Syedur Rahman's simulator while incorporating modern Test cricket dynamics. The interface should be clean, information-dense, and allow users to progress ball-by-ball with spacebar or "Next

LandingResultScorecard
Landing

Comments (0)

No comments yet. Be the first!

System Requirements

System Requirement Document
Page 1 of 5

zen-cricket System Requirements Document

1. Introduction

Welcome to the System Requirements Document for zen-cricket, a Test cricket match simulator inspired by Syedur Rahman's classic cricket simulator from the early 2000s. This document outlines the requirements and design elements necessary to create an immersive and realistic cricket simulation experience for cricket enthusiasts like John Pennington.

2. System Overview

zen-cricket aims to provide a comprehensive and realistic Test cricket simulation experience. The simulator will capture the nostalgic feel of classic cricket simulators while incorporating modern Test cricket dynamics. It will feature a text-based interface with ASCII art elements, allowing users to simulate full 5-day Test matches with realistic match conditions, player attributes, and AI behavior.

Page 2 of 5

3. Functional Requirements

  • As a User, I should be able to simulate a full 5-day Test match with two innings per team.
  • As a User, I should be able to see overs bowled in groups of 6 balls with a realistic session structure (90 overs per day: 30-30-30 split across three sessions).
  • As a User, I should be able to enforce follow-on rules when the lead is 200+ runs.
  • As a User, I should be able to declare innings as the batting team.
  • As a User, I should experience realistic match outcomes such as draw, win by innings, or win by runs/wickets.
  • As a User, I should see a text-based interface with ASCII art elements for scoreboards and commentary.
  • As a User, I should be able to view a clean and sensible scorecard with detailed statistics.
  • As a User, I should experience modern Test match run rates and realistic batting mechanics.
  • As a User, I should see realistic bowling mechanics with a fatigue system affecting performance.
  • As a User, I should be able to manage teams, select players, and control bowling changes.
  • As a User, I should experience AI behavior that makes realistic decisions and adapts to match situations.
  • As a User, I should be able to track individual and team statistics throughout the match.

4. User Personas

  • Cricket Enthusiast: A user who is passionate about cricket and enjoys simulating matches with realistic outcomes and strategies.
  • Team Manager: A user who enjoys managing teams, selecting players, and making strategic decisions during matches.
  • Statistician: A user who is interested in tracking detailed match statistics and analyzing player performances.
Page 3 of 5

5. Visuals Colors and Theme

  • primary: #004d40 (deep teal)
  • primary_light: #39796b (lighter teal)
  • secondary: #ffab00 (amber)
  • accent: #d50000 (red)
  • highlight: #ff6f00 (orange)
  • bg: #f5f5f5 (light grey)
  • surface: rgba(255, 255, 255, 0.9) (white)
  • text: #212121 (dark grey)
  • text_muted: #757575 (medium grey)
  • border: rgba(0, 0, 0, 0.1) (light black)

6. Signature Design Concept

The zen-cricket simulator will feature an interactive "Cricket Field" homepage. Users will navigate a stylized cricket field where each section of the field represents different aspects of the game (e.g., batting, bowling, scorecard). As users hover over different areas, animations will reveal detailed information and options for interaction. The field will be designed using @react-three/fiber for a 3D effect, allowing users to click and drag to explore different sections. The interface will include subtle animations using framer-motion to enhance the interactive experience, such as spring physics when selecting players or making strategic decisions.

Page 4 of 5

7. Interaction Model & Motion Direction

  • Interaction Model: Parallax
    • The landing page will feature layered depth via scroll, with decorative elements like cricket bats moving at different speeds.
    • Real content, such as match details and player statistics, will scroll naturally.
    • Each section on the landing page will have a distinctive core mechanic, such as a 3D scene for team management or a kinetic typography display for match commentary.

8. Non-Functional Requirements

  • The simulator should produce realistic match outcomes with logical rule implementation.
  • The interface should be clean, information-dense, and allow users to progress ball-by-ball with ease.
  • The system should handle multiple users simultaneously without performance degradation.

9. Tech Stack

  • Frontend: Vanilla HTML/CSS/JavaScript
  • Backend: Python, FastAPI
  • Database: MySQL or MariaDB
  • AI Models: Not applicable
  • Local Orchestration: Docker, docker-compose
Page 5 of 5

10. Assumptions and Constraints

  • The simulator will be web-based and accessible via modern web browsers.
  • Users will have a basic understanding of cricket rules and terminology.
  • The system will not include real-time multiplayer functionality.

11. Glossary

  • Follow-on: A rule in cricket where the team batting first can make the opponents bat again if they don't get within 200 runs of their first innings total.
  • Declaration: The act of a batting team ending their innings voluntarily.
  • Parallax: A design technique where background images move slower than foreground images, creating an illusion of depth.
Landing design preview
Landing: View Simulator
Setup: Choose Teams
Setup: Select Players
Setup: Choose Conditions
Match: Watch Ball-by-Ball
Match: Progress Session
Match: View Over Summary
Scorecard: View Batting Stats
Scorecard: View Bowling Figures
Result: View Match Summary