From 13427afb35e30f1aba815b266ec55e902fac06f2 Mon Sep 17 00:00:00 2001 From: majorbruteforce Date: Wed, 25 Dec 2024 22:32:13 +0530 Subject: [PATCH] vault backup: 2024-12-25 22:32:13 --- content/Projects/GC/Product/Requirement.md | 7 ++- .../Projects/GC/Terminologies/MatchEvent.md | 35 +++++++++++++++ .../Projects/GC/Terminologies/MatchFormat.md | 44 +++++++++++++++++++ .../Projects/GC/Terminologies/MatchState.md | 7 ++- 4 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 content/Projects/GC/Terminologies/MatchEvent.md create mode 100644 content/Projects/GC/Terminologies/MatchFormat.md rename MatchState.md => content/Projects/GC/Terminologies/MatchState.md (98%) diff --git a/content/Projects/GC/Product/Requirement.md b/content/Projects/GC/Product/Requirement.md index 561e326..11705d6 100644 --- a/content/Projects/GC/Product/Requirement.md +++ b/content/Projects/GC/Product/Requirement.md @@ -114,13 +114,12 @@ This functionality is important for maintaining a smooth and organized system, w A collection of variables defining the current status of the match, such as scores, wickets, overs, time elapsed, player positions, or ongoing penalties. -### Delta +[See an example](Terminologies/MatchState) +### Event A specific change or update in the match state, such as scoring a run, losing a wicket, or bowling an illegal delivery. -### Event - -An occurrence in the match that may or may not alter the state, such as interruptions (rain delay), substitutions, milestones (end of an over, half-century), or a delta. Event is a super-set of delta. +[See an example](Terminologies/MatchEvent) ### Timeline diff --git a/content/Projects/GC/Terminologies/MatchEvent.md b/content/Projects/GC/Terminologies/MatchEvent.md new file mode 100644 index 0000000..f17dfc0 --- /dev/null +++ b/content/Projects/GC/Terminologies/MatchEvent.md @@ -0,0 +1,35 @@ +A **match event** is an atomic change or action that alters the state of a match. In this case, the event will represent a change. It is a subset of [[MatchState|Match State]]. + +The event size should be as minimal as possible. It should contain _just enough_ information to convey every change in the state. Avoid specifying information that can be derived. (for example, in the examples timestamp and penalty can be calculated in the server itself without having to be passed explicitly) + +An event for runs scored might look like: + +```javascript +const event24 = { + type: "run_scored", + details: { + runs: 4, + scoringType: "boundary", // "run", "byes", "legbyes", "dot" + illegal: "no_ball", // "wide" + penalty: 1, // 0 for legal + }, + timestamp: new Date() +}; + +``` + +An event for wicket fallen might look like: + +```javascript +const event24 = { + type: "wicket_fallen", + details: { + playerOut: "PlayerX", // needed for case like runouts, munkading etc + outReason: ["b", "Bowler1", null], + illegal: null, + penalty: null + }, + timestamp: new Date() +}; + +``` \ No newline at end of file diff --git a/content/Projects/GC/Terminologies/MatchFormat.md b/content/Projects/GC/Terminologies/MatchFormat.md new file mode 100644 index 0000000..9ed7772 --- /dev/null +++ b/content/Projects/GC/Terminologies/MatchFormat.md @@ -0,0 +1,44 @@ +They are the constraints for the variables in [[MatchState | match state]]. They can be predefined or custom made while creating a match. + +```javascript +const matchFormat = { + totalOvers: 10, + powerplayOvers: 2, + legalDeliveriesPerOver: 6, + + penaltyActions: { + noBall: () => ({ + illegal: "no_ball", + freeHit: true, + penalty: 1 + }), + + wide: () => ({ + illegal: "wide", + freeHit: false, + penalty: 1 + }) + }, + + extrasActions: { + byes: (runs) => ({ + type: "byes", + penalty: runs, + description: `Byes: ${runs} run(s)` + }), + + legByes: (runs) => ({ + type: "leg_byes", + penalty: runs, + description: `Leg byes: ${runs} run(s)` + }) + }, + + applyPowerPlayRestrictions: (overs) => { + return overs <= matchFormat.powerplayOvers + ? "Only two fielders outside the 30-yard circle during powerplay." + : "Normal fielding restrictions apply after powerplay."; + } +}; + +``` diff --git a/MatchState.md b/content/Projects/GC/Terminologies/MatchState.md similarity index 98% rename from MatchState.md rename to content/Projects/GC/Terminologies/MatchState.md index 6454305..79e71a4 100644 --- a/MatchState.md +++ b/content/Projects/GC/Terminologies/MatchState.md @@ -1,10 +1,9 @@ -A state is a set of variables that describe the current state of a match. They are governed by match format. +A state is a set of variables that describe the current state of a match. Match state for cricket might look like this: ```javascript const matchState = { - State: { innings: { first: { battingTeam: "EEE", @@ -68,6 +67,7 @@ const matchState = { ] }, Bowling: { + freeHit: false, bowler: { name: "Bowler1", overs: 1.5, @@ -152,8 +152,7 @@ const matchState = { null, // run/wickets null // 32/4 ] - } -}; + }; ```