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

threshold

Awards 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

exact

Awards flat points when stat === value.

{ "stat": "finish_position", "operator": "exact", "value": 1, "points": 25 }
range

Awards flat points when min ≤ stat ≤ max.

{ "stat": "finish_position", "operator": "range", "value": [3, 10], "points": 12 }
boolean

Awards 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:

SportCommon Stat Fields
F1finish_position, grid_position, is_fastest_lap, laps_completed, points_scored
NFLpassing_yards, rushing_yards, receiving_yards, touchdowns, interceptions, receptions
NBApoints, rebounds, assists, steals, blocks, turnovers, three_pointers_made
CustomAny field you send in the event value object