From bf06de0f5e9531e7785e6665346fe29f0d64e28d Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Sun, 1 Feb 2026 15:31:46 -0500 Subject: [PATCH] horse: rearrange career race results --- horse/race.kk | 23 +++-------------------- horse/trainee.kk | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/horse/race.kk b/horse/race.kk index 3b509a7..9742b5d 100644 --- a/horse/race.kk +++ b/horse/race.kk @@ -67,29 +67,12 @@ pub fun grade/show(this : grade) : e string G1 -> "G1" EX -> "EX" -// Graded race that a veteran ran. -pub struct race-result +// Instance of a race. +pub struct race-instance-detail + race-instance-id: race-instance-id race-id: race-id - place: int turn: turn -// Automatically generated. -// Equality comparison of the `race-result` type. -pub fun race-result/(==)(this : race-result, other : race-result) : e bool - match (this, other) - (Race-result(race, place, turn), Race-result(race', place', turn')) -> race == race' && place == place' && turn == turn' - -// Automatically generated. -// Shows a string representation of the `race-result` type. -pub fun race-result/show(this : race-result, ?race/show: (race-id) -> string) : e string - match this - Race-result(race-id, place, turn) -> turn.show ++ " " ++ race-id.show ++ ": " ++ place.show - -// Determine whether two race results are for the same race. -// This differs from (==) which also requires the race to be on the same turn. -pub fun race-result/same-race(a: race-result, b: race-result): bool - a.race-id == b.race-id - // Turn that a race occurred. pub struct turn year: turn-year diff --git a/horse/trainee.kk b/horse/trainee.kk index d1df74a..8a77fe2 100644 --- a/horse/trainee.kk +++ b/horse/trainee.kk @@ -1,5 +1,6 @@ module horse/trainee +import horse/game-id import horse/movement // Details of a trainee. @@ -14,3 +15,24 @@ pub struct trainee-detail pace-chaser: level late-surger: level end-closer: level + +// Graded race that a veteran ran. +pub struct race-result + race-id: race-id + race-instance-id: race-instance-id + place: int + +// Automatically generated. +// Equality comparison of the `race-result` type. +pub fun race-result/(==)(this : race-result, other : race-result) : e bool + match (this, other) + (Race-result(race-id, race-instance-id, place), Race-result(race-id', race-instance-id', place')) -> race-id == race-id' && race-instance-id == race-instance-id' && place == place' + +pub fun race-result/show(r: race-result, ?race/show: (race-id) -> string) : e string + val Race-result(race, _, place) = r + race.show ++ ": " ++ place.show + +// Determine whether two race results are for the same race. +// This differs from (==) which also requires the race to be on the same turn. +pub fun race-result/same-race(a: race-result, b: race-result): bool + a.race-id == b.race-id