302 lines
8.9 KiB
Plaintext
302 lines
8.9 KiB
Plaintext
module horse/race
|
|
|
|
import std/data/linearset
|
|
import horse/game-id
|
|
|
|
pub struct race-detail
|
|
race-id: race-id
|
|
name: string
|
|
grade: grade
|
|
thumbnail-id: race-thumbnail-id
|
|
// Some careers contain unusual versions of races, e.g. Tenno Sho (Spring)
|
|
// in Hanshin instead of Kyoto for Narita Taishin and Biwa Hayahide.
|
|
// For such races, this field holds the normal race ID.
|
|
primary: race-id
|
|
|
|
pub fun detail(
|
|
r: race-id,
|
|
?race/show: (race-id) -> string,
|
|
?race/grade: (race-id) -> grade,
|
|
?race/thumbnail: (race-id) -> race-thumbnail-id,
|
|
?race/primary: (race-id) -> race-id
|
|
): race-detail
|
|
Race-detail(r, r.show, r.grade, r.thumbnail, r.primary)
|
|
|
|
pub fun race-detail/show(r: race-detail): string
|
|
val Race-detail(Race-id(id), name) = r
|
|
name ++ " (ID " ++ id.show ++ ")"
|
|
|
|
// Race grades.
|
|
pub type grade
|
|
Pre-OP
|
|
OP
|
|
G3
|
|
G2
|
|
G1
|
|
EX
|
|
|
|
// Automatically generated.
|
|
// Comparison of the `grade` type.
|
|
pub fun grade/cmp(this : grade, other : grade) : e order
|
|
match (this, other)
|
|
(Pre-OP, Pre-OP) -> Eq
|
|
(Pre-OP, _) -> Lt
|
|
(_, Pre-OP) -> Gt
|
|
(OP, OP) -> Eq
|
|
(OP, _) -> Lt
|
|
(_, OP) -> Gt
|
|
(G3, G3) -> Eq
|
|
(G3, _) -> Lt
|
|
(_, G3) -> Gt
|
|
(G2, G2) -> Eq
|
|
(G2, _) -> Lt
|
|
(_, G2) -> Gt
|
|
(G1, G1) -> Eq
|
|
(G1, _) -> Lt
|
|
(_, G1) -> Gt
|
|
(EX, EX) -> Eq
|
|
|
|
// Automatically generated.
|
|
// Shows a string representation of the `grade` type.
|
|
pub fun grade/show(this : grade) : e string
|
|
match this
|
|
Pre-OP -> "Pre-OP"
|
|
OP -> "OP"
|
|
G3 -> "G3"
|
|
G2 -> "G2"
|
|
G1 -> "G1"
|
|
EX -> "EX"
|
|
|
|
pub struct saddle-detail
|
|
saddle-id: saddle-id
|
|
name: string
|
|
races: list<race-id>
|
|
saddle-type: saddle-type
|
|
// For careers with unusual races, granted saddles also differ.
|
|
// This field holds the normal saddle's ID for such cases.
|
|
primary: saddle-id
|
|
|
|
pub fun saddle/detail(
|
|
id: saddle-id,
|
|
?saddle/show: (saddle-id) -> string,
|
|
?saddle/races: (saddle-id) -> list<race-id>,
|
|
?saddle/saddle-type: (saddle-id) -> saddle-type,
|
|
?saddle/primary: (saddle-id) -> saddle-id
|
|
): saddle-detail
|
|
Saddle-detail(id, id.show, id.races, id.saddle-type, id.primary)
|
|
|
|
pub fun saddle-detail/show(s: saddle-detail): string
|
|
val Saddle-detail(Saddle-id(id), name, _, _, Saddle-id(primary)) = s
|
|
if id == primary then name else name ++ " (Alternate " ++ id.show ++ ")"
|
|
|
|
// Types of saddles.
|
|
pub type saddle-type
|
|
Honor // multiple race wins: classic triple crown, dual grand prix, &c.
|
|
G3-Win
|
|
G2-Win
|
|
G1-Win
|
|
|
|
// Automatically generated.
|
|
// Shows a string representation of the `saddle-type` type.
|
|
pub fun saddle-type/show(this : saddle-type) : e string
|
|
match this
|
|
Honor -> "Honor"
|
|
G3-Win -> "G3"
|
|
G2-Win -> "G2"
|
|
G1-Win -> "G1"
|
|
|
|
// Automatically generated.
|
|
// Equality comparison of the `saddle-type` type.
|
|
pub fun saddle-type/(==)(this : saddle-type, other : saddle-type) : e bool
|
|
match (this, other)
|
|
(Honor, Honor) -> True
|
|
(G3-Win, G3-Win) -> True
|
|
(G2-Win, G2-Win) -> True
|
|
(G1-Win, G1-Win) -> True
|
|
(_, _) -> False
|
|
|
|
// Turn that a race occurred.
|
|
pub struct turn
|
|
year: turn-year
|
|
month: turn-month
|
|
half: turn-half
|
|
|
|
// Automatically generated.
|
|
// Equality comparison of the `turn` type.
|
|
pub fun turn/(==)(this : turn, other : turn) : e bool
|
|
match (this, other)
|
|
(Turn(year, month, half), Turn(year', month', half')) -> year == year' && month == month' && half == half'
|
|
|
|
// Automatically generated.
|
|
// Fip comparison of the `turn` type.
|
|
pub fun turn/order2(this : turn, other : turn) : e order2<turn>
|
|
match (this, other)
|
|
(Turn(year, month, half), Turn(year', month', half')) ->
|
|
match year.order2(year')
|
|
Eq2(year_eq) ->
|
|
match month.order2(month')
|
|
Eq2(month_eq) ->
|
|
match half.order2(half')
|
|
Eq2(half_eq) -> Eq2(Turn(year_eq, month_eq, half_eq))
|
|
Lt2(half_lt, half_gt) -> Lt2(Turn(year_eq, month_eq, half_lt), Turn(year_eq, month_eq, half_gt))
|
|
Gt2(half_lt, half_gt) -> Gt2(Turn(year_eq, month_eq, half_lt), Turn(year_eq, month_eq, half_gt))
|
|
Lt2(month_lt, month_gt) -> Lt2(Turn(year_eq, month_lt, half), Turn(year_eq, month_gt, half'))
|
|
Gt2(month_lt, month_gt) -> Gt2(Turn(year_eq, month_lt, half'), Turn(year_eq, month_gt, half))
|
|
Lt2(year_lt, year_gt) -> Lt2(Turn(year_lt, month, half), Turn(year_gt, month', half'))
|
|
Gt2(year_lt, year_gt) -> Gt2(Turn(year_lt, month', half'), Turn(year_gt, month, half))
|
|
|
|
// Automatically generated.
|
|
// Shows a string representation of the `turn` type.
|
|
pub fun turn/show(this : turn) : e string
|
|
this.year.show ++ " " ++ this.half.show ++ " " ++ this.month.show
|
|
|
|
pub type turn-year
|
|
Junior
|
|
Classic
|
|
Senior
|
|
Finale
|
|
|
|
// Automatically generated.
|
|
// Equality comparison of the `turn-year` type.
|
|
pub fun turn-year/(==)(this : turn-year, other : turn-year) : e bool
|
|
match (this, other)
|
|
(Junior, Junior) -> True
|
|
(Classic, Classic) -> True
|
|
(Senior, Senior) -> True
|
|
(Finale, Finale) -> True
|
|
(_, _) -> False
|
|
|
|
// Automatically generated.
|
|
// Fip comparison of the `turn-year` type.
|
|
pub fun turn-year/order2(this : turn-year, other : turn-year) : e order2<turn-year>
|
|
match (this, other)
|
|
(Junior, Junior) -> Eq2(Junior)
|
|
(Junior, other') -> Lt2(Junior, other')
|
|
(this', Junior) -> Gt2(Junior, this')
|
|
(Classic, Classic) -> Eq2(Classic)
|
|
(Classic, other') -> Lt2(Classic, other')
|
|
(this', Classic) -> Gt2(Classic, this')
|
|
(Senior, Senior) -> Eq2(Senior)
|
|
(Senior, other') -> Lt2(Senior, other')
|
|
(this', Senior) -> Gt2(Senior, this')
|
|
(Finale, Finale) -> Eq2(Finale)
|
|
|
|
// Automatically generated.
|
|
// Shows a string representation of the `turn-year` type.
|
|
pub fun turn-year/show(this : turn-year) : e string
|
|
match this
|
|
Junior -> "Junior Year"
|
|
Classic -> "Classic Year"
|
|
Senior -> "Senior Year"
|
|
Finale -> "Finale 1" // the 1 is in the game
|
|
|
|
pub type turn-month
|
|
January
|
|
February
|
|
March
|
|
April
|
|
May
|
|
June
|
|
July
|
|
August
|
|
September
|
|
November
|
|
December
|
|
|
|
// Automatically generated.
|
|
// Equality comparison of the `turn-month` type.
|
|
pub fun turn-month/(==)(this : turn-month, other : turn-month) : e bool
|
|
match (this, other)
|
|
(January, January) -> True
|
|
(February, February) -> True
|
|
(March, March) -> True
|
|
(April, April) -> True
|
|
(May, May) -> True
|
|
(June, June) -> True
|
|
(July, July) -> True
|
|
(August, August) -> True
|
|
(September, September) -> True
|
|
(November, November) -> True
|
|
(December, December) -> True
|
|
(_, _) -> False
|
|
|
|
// Automatically generated.
|
|
// Fip comparison of the `turn-month` type.
|
|
pub fun turn-month/order2(this : turn-month, other : turn-month) : e order2<turn-month>
|
|
match (this, other)
|
|
(January, January) -> Eq2(January)
|
|
(January, other') -> Lt2(January, other')
|
|
(this', January) -> Gt2(January, this')
|
|
(February, February) -> Eq2(February)
|
|
(February, other') -> Lt2(February, other')
|
|
(this', February) -> Gt2(February, this')
|
|
(March, March) -> Eq2(March)
|
|
(March, other') -> Lt2(March, other')
|
|
(this', March) -> Gt2(March, this')
|
|
(April, April) -> Eq2(April)
|
|
(April, other') -> Lt2(April, other')
|
|
(this', April) -> Gt2(April, this')
|
|
(May, May) -> Eq2(May)
|
|
(May, other') -> Lt2(May, other')
|
|
(this', May) -> Gt2(May, this')
|
|
(June, June) -> Eq2(June)
|
|
(June, other') -> Lt2(June, other')
|
|
(this', June) -> Gt2(June, this')
|
|
(July, July) -> Eq2(July)
|
|
(July, other') -> Lt2(July, other')
|
|
(this', July) -> Gt2(July, this')
|
|
(August, August) -> Eq2(August)
|
|
(August, other') -> Lt2(August, other')
|
|
(this', August) -> Gt2(August, this')
|
|
(September, September) -> Eq2(September)
|
|
(September, other') -> Lt2(September, other')
|
|
(this', September) -> Gt2(September, this')
|
|
(November, November) -> Eq2(November)
|
|
(November, other') -> Lt2(November, other')
|
|
(this', November) -> Gt2(November, this')
|
|
(December, December) -> Eq2(December)
|
|
|
|
// Automatically generated.
|
|
// Shows a string representation of the `turn-month` type.
|
|
pub fun turn-month/show(this : turn-month) : e string
|
|
match this
|
|
January -> "January"
|
|
February -> "February"
|
|
March -> "March"
|
|
April -> "April"
|
|
May -> "May"
|
|
June -> "June"
|
|
July -> "July"
|
|
August -> "August"
|
|
September -> "September"
|
|
November -> "November"
|
|
December -> "December"
|
|
|
|
pub type turn-half
|
|
Early
|
|
Late
|
|
|
|
// Automatically generated.
|
|
// Equality comparison of the `turn-half` type.
|
|
pub fun turn-half/(==)(this : turn-half, other : turn-half) : e bool
|
|
match (this, other)
|
|
(Early, Early) -> True
|
|
(Late, Late) -> True
|
|
(_, _) -> False
|
|
|
|
// Automatically generated.
|
|
// Fip comparison of the `turn-half` type.
|
|
pub fun turn-half/order2(this : turn-half, other : turn-half) : e order2<turn-half>
|
|
match (this, other)
|
|
(Early, Early) -> Eq2(Early)
|
|
(Early, other') -> Lt2(Early, other')
|
|
(this', Early) -> Gt2(Early, this')
|
|
(Late, Late) -> Eq2(Late)
|
|
|
|
// Automatically generated.
|
|
// Shows a string representation of the `turn-half` type.
|
|
pub fun turn-half/show(this : turn-half) : e string
|
|
match this
|
|
Early -> "Early"
|
|
Late -> "Late"
|