generated from jackyzha0/quartz
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11674f5
commit 13427af
Showing
4 changed files
with
85 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}; | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."; | ||
} | ||
}; | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters