Skip to content

Commit

Permalink
vault backup: 2024-12-25 22:32:13
Browse files Browse the repository at this point in the history
  • Loading branch information
majorbruteforce committed Dec 25, 2024
1 parent 11674f5 commit 13427af
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 8 deletions.
7 changes: 3 additions & 4 deletions content/Projects/GC/Product/Requirement.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
35 changes: 35 additions & 0 deletions content/Projects/GC/Terminologies/MatchEvent.md
Original file line number Diff line number Diff line change
@@ -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()
};

```
44 changes: 44 additions & 0 deletions content/Projects/GC/Terminologies/MatchFormat.md
Original file line number Diff line number Diff line change
@@ -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.";
}
};

```
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -68,6 +67,7 @@ const matchState = {
]
},
Bowling: {
freeHit: false,
bowler: {
name: "Bowler1",
overs: 1.5,
Expand Down Expand Up @@ -152,8 +152,7 @@ const matchState = {
null, // run/wickets
null // 32/4
]
}
};
};

```

0 comments on commit 13427af

Please sign in to comment.