import type { DeadTimeRules } from "./replay.deadtime.ts"; /** Why play stopped, in hockey: each says where it starts again. */ export type HockeyStop = "goal" | "save" | "frozen" | "icing" | "offside" | "penalty" | "whistle" | "period-start" | "period-end"; /** The nine face-off spots, feet from centre ice (NHL Rule 1.9): centre, the four in the neutral zone (5 feet outside the blue lines, 44 feet apart) and the four in the end zones (20 feet out from the goal lines, 44 feet apart). */ export declare const HOCKEY_DOTS: readonly (readonly [number, number])[]; /** The blue lines are 25 feet either side of centre: past one, play is in an end zone. */ export declare const HOCKEY_BLUE_LINE = 25; /** Is a place one of the nine face-off spots (to a tenth of a foot)? */ export declare const isHockeyDot: (x: number, y: number) => boolean; /** Where play stopped and why, to say where it starts again. */ export interface HockeyStopAt { reason: HockeyStop | string; /** Where play stopped: the puck's place, or for a save the place the shot came from. Centre ice when not given. */ x?: number; y?: number; /** For icing, offside and a penalty: the end the side it was called against defends, as the sign of its goal line's x (-1 for the left end, 1 for the right). */ defends?: 1 | -1; } /** * The face-off spot play starts again at after a stoppage, by NHL rule: centre ice after a goal and at the start of a period; after a save or a frozen puck, the end-zone spot of that end on the side * the puck was (the nearest spot in the zone); after icing and after a penalty, an end-zone spot of the end the offending side defends (Rules 81 and 76); after offside, the * neutral-zone spot just outside the zone the offending side attacks (Rule 83); after any other whistle, the nearest spot in the zone where play stopped (an end-zone spot in an end, a neutral-zone * spot between the blue lines, never centre ice). An end-zone spot's side is the side of the rink the puck was on. * @example * ```ts * import { hockeyFaceoffDot } from "@johnmorrisdotca/kyogijo-stadiums/replay"; * console.log(hockeyFaceoffDot({ reason: "goal", x: 88, y: 2 }).join(), hockeyFaceoffDot({ reason: "save", x: 60, y: -18 }).join()); * console.log(hockeyFaceoffDot({ reason: "icing", x: 80, y: 30, defends: -1 }).join(), hockeyFaceoffDot({ reason: "offside", x: 26, y: 5, defends: -1 }).join()); * // 0,0 69,-22 * // -69,22 20,22 * ``` */ export declare function hockeyFaceoffDot(stop: HockeyStopAt): readonly [number, number]; /** The places of a face-off's line-up. */ export type HockeyRole = "C" | "LW" | "RW" | "LD" | "RD" | "G"; /** * Where a side lines up for a face-off at a spot (NHL Rule 76), as `[x, y]` in feet from centre ice: `attacks` is the end it attacks (1 for the right). The centre stands on the dot a step back on his * own side; the wingers on their own side of the circle's hash marks, outside it; the defence behind them (at the blue line when the spot is in the end the side attacks, in front of its own net when it * is in its own end, a stride back from the wingers at centre and in the neutral zone); the goaltender in the crease. A left winger is on the left of a player facing the end his side attacks. * @example * ```ts * import { hockeyFormation } from "@johnmorrisdotca/kyogijo-stadiums/replay"; * const at = hockeyFormation([0, 0], 1); * console.log(at.C.join(), at.LW.join(), at.G.join()); * // -2.5,0 -5,17 -85,0 * ``` */ export declare function hockeyFormation(dot: readonly [number, number], attacks: 1 | -1): Record; /** The speeds and seconds of hockey's dead time in a replay, and where each side's bench is. */ export declare const HOCKEY_DEAD_TIME: { /** The fastest a player glides to his place, feet a second (about 12 miles an hour: a glide, not a sprint). */ readonly speed: 18; /** Seconds before the players head for the face-off: a goal is celebrated. */ readonly pause: { readonly goal: 2.5; readonly other: 0.6; }; /** Seconds the dead puck is seen where it stopped (in the net after a goal), then out of sight until the drop. */ readonly shown: { readonly goal: 2.5; readonly other: 1.2; }; /** The least time the players take to their places, and the seconds they stand in them before the puck is dropped. */ readonly least: 2; readonly hold: 1; /** The line-up before the opening face-off of a period, seconds: the clock reads the period's full time until the drop. */ readonly lineUp: 1.5; /** The players' benches' gates, on the side of negative y (the side the benches are on, as the arenas draw them): the home side's nearer the left end, the away side's the right. */ readonly bench: Record<"home" | "away", readonly [number, number]>; }; /** Hockey's dead time as `addDeadTime` reads it: the puck is the dead one, and a player going off or coming on goes by his side's bench. */ export declare const HOCKEY_RULES: DeadTimeRules; /** * The stoppage a play of an NHL-style play-by-play is (`typeDescKey` and, for a `stoppage`, `details.reason`): `goal`, `penalty`, the rule set's word for the stoppage's reason, or `undefined` for a * play that does not stop play (a shot, a hit, a delayed penalty, which play goes on through until the side it is against touches the puck). * @example * ```ts * import { hockeyStopOf } from "@johnmorrisdotca/kyogijo-stadiums/replay"; * console.log(hockeyStopOf("stoppage", "icing"), hockeyStopOf("stoppage", "puck-in-netting"), hockeyStopOf("goal"), hockeyStopOf("delayed-penalty")); * // icing whistle goal undefined * ``` */ export declare function hockeyStopOf(typeDescKey: string, reason?: string): HockeyStop | undefined; /** The kinds of penalty, and their minutes on the game clock (NHL Rules 16 to 21: a minor 2, a double minor 4, a major 5, a misconduct 10; a bench minor is a minor served by a player the coach names). */ export declare const HOCKEY_PENALTY_MINUTES: { readonly minor: 2; readonly "bench-minor": 2; readonly "double-minor": 4; readonly major: 5; readonly misconduct: 10; }; export type HockeyPenaltyKind = keyof typeof HOCKEY_PENALTY_MINUTES; /** * The kind of a penalty of an NHL-style play-by-play (`details.typeCode` and `details.duration` of a `penalty`): `MIN` a minor (4 minutes of it a double minor), `BEN` a bench minor, `MAJ` a major, * `MIS` and `GMIS` a misconduct; else by its minutes. `undefined` for a penalty shot or a match penalty, which this rule set does not play. * @example * ```ts * import { hockeyPenaltyKind } from "@johnmorrisdotca/kyogijo-stadiums/replay"; * console.log(hockeyPenaltyKind("MIN", 2), hockeyPenaltyKind("MIN", 4), hockeyPenaltyKind("BEN", 2), hockeyPenaltyKind("MAJ", 5), hockeyPenaltyKind("MIS", 10), hockeyPenaltyKind("PS", 0)); * // minor double-minor bench-minor major misconduct undefined * ``` */ export declare function hockeyPenaltyKind(typeCode?: string, duration?: number): HockeyPenaltyKind | undefined; /** * Where a side's penalty box is, the seat its penalized player sits on, in the `nhl-api` frame: across the ice from the players' benches (NHL Rule 1: the two penalty boxes on the side opposite the * benches, one each side of the off-ice officials' box at centre), the home side's on the left, behind the boards. A stand-in for the rink's own figures (the benches and boxes of the rink, KYOGIJO- * STADIUMS-47) until they are in the package: then this reads them, and nothing that calls it changes. */ export declare function hockeyPenaltyBox(team: "home" | "away"): readonly [number, number]; /** A call of a penalty, on the game clock: when (seconds of game played since the start), against which side, what kind. */ export interface HockeyCall { team: "home" | "away"; kind: HockeyPenaltyKind; at: number; } /** When a penalty's time begins and ends on the game clock, and whether its side plays short. */ export interface HockeyServed { /** When its time begins: the call, or, for a side already two short, when one of those ends (it never plays with fewer than three skaters). */ from: number; /** When the player leaves the box: his time ran out, or a power-play goal ended his minor. */ to: number; short: boolean; /** Ended by a power-play goal. */ byGoal: boolean; } /** * How a game's penalties are served, by NHL rule, all on the game clock (seconds played since the start): each penalty's player sits from the call; a minor is 2 minutes, a double minor 4, a major 5 and a * misconduct 10; his side plays a skater short (not for a misconduct, served by a substitute, nor for coincidental penalties, called on both sides at once and as many each, which leave the strength * even); a side is never more than two short, so a third penalty's time waits for one of the first two to end; a goal by the side with more skaters ends the scored-on side's minor with the least time * left (a double minor loses the part it is in; a major is served in full). Pure. * @example * ```ts * import { hockeyPenaltyEnds } from "@johnmorrisdotca/kyogijo-stadiums/replay"; * const calls = [{ team: "away" as const, kind: "minor" as const, at: 100 }, { team: "home" as const, kind: "major" as const, at: 400 }]; * const goals = [{ team: "home" as const, at: 160 }, { team: "away" as const, at: 500 }]; * console.log(hockeyPenaltyEnds(calls, goals).map((s) => `${s.from}-${s.to} ${s.short} ${s.byGoal}`).join(", ")); * // 100-160 true true, 400-700 true false * ``` */ export declare function hockeyPenaltyEnds(calls: readonly HockeyCall[], goals: readonly { team: "home" | "away"; at: number; }[]): HockeyServed[];