Game DSL Reference
Game DSL Reference
The Game DSL is an array of rule contracts sent in the scoring_rules field when creating a league. Each rule maps a stat field in your event data to a point value.
Rule Contract Schema
{
"stat": string,
"operator": "threshold" | "exact" | "range" | "boolean",
"value": number | [number, number] | boolean,
"points": number
}Operators
thresholdAwards stat × points when the stat value meets or exceeds value.
{ "stat": "passing_yards", "operator": "threshold", "value": 1, "points": 0.04 }300 passing yards → 300 × 0.04 = 12 points
exactAwards flat points when stat === value.
{ "stat": "finish_position", "operator": "exact", "value": 1, "points": 25 }rangeAwards flat points when min ≤ stat ≤ max.
{ "stat": "finish_position", "operator": "range", "value": [3, 10], "points": 12 }booleanAwards flat points when the stat is truthy.
{ "stat": "is_fastest_lap", "operator": "boolean", "value": true, "points": 1 }Compound Rules
All rules in the array are evaluated independently and points are summed. There is no short-circuit evaluation — every rule is checked against every event.
Supported Sports
The Game DSL works for any sport or custom entity. You define the stat names — Chikoh evaluates them against your event data. Common stat fields by sport:
| Sport | Common Stat Fields |
|---|---|
| F1 | finish_position, grid_position, is_fastest_lap, laps_completed, points_scored |
| NFL | passing_yards, rushing_yards, receiving_yards, touchdowns, interceptions, receptions |
| NBA | points, rebounds, assists, steals, blocks, turnovers, three_pointers_made |
| Custom | Any field you send in the event value object |