From 7dcf6bca6a5ff1cab4c5409deace03b04c8d2cf1 Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Thu, 1 Jan 2026 19:26:57 -0500 Subject: [PATCH] initial representation of uma and sparks --- .gitignore | 2 + .gitmodules | 3 + horse/horse.kk | 70 ++++++++++++++++++ horse/spark.kk | 187 +++++++++++++++++++++++++++++++++++++++++++++++++ std | 1 + 5 files changed, 263 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 horse/horse.kk create mode 100644 horse/spark.kk create mode 160000 std diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7596c83 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.koka +.vscode diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b7c27e5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "std"] + path = std + url = git@github.com:koka-community/std.git diff --git a/horse/horse.kk b/horse/horse.kk new file mode 100644 index 0000000..b716c1e --- /dev/null +++ b/horse/horse.kk @@ -0,0 +1,70 @@ +module horse/horse + +import std/data/rb-map + +// Aptitudes of an umamusume being trained. +pub struct uma + turf: aptitudes + dirt: aptitudes + sprint: aptitudes + mile: aptitudes + medium: aptitudes + long: aptitudes + front-runner: aptitudes + pace-chaser: aptitudes + late-surger: aptitudes + end-closer: aptitudes + +// Aptitude level distribution. +pub alias aptitudes = rbmap + +// Starting aptitude levels. +pub type level + G + F + E + D + C + B + A + S + +// Automatically generated. +// Fip comparison of the `level` type. +pub fun level/order2(this : level, other : level) : order2 + match (this, other) + (G, G) -> Eq2(G) + (G, other') -> Lt2(G, other') + (this', G) -> Gt2(G, this') + (F, F) -> Eq2(F) + (F, other') -> Lt2(F, other') + (this', F) -> Gt2(F, this') + (E, E) -> Eq2(E) + (E, other') -> Lt2(E, other') + (this', E) -> Gt2(E, this') + (D, D) -> Eq2(D) + (D, other') -> Lt2(D, other') + (this', D) -> Gt2(D, this') + (C, C) -> Eq2(C) + (C, other') -> Lt2(C, other') + (this', C) -> Gt2(C, this') + (B, B) -> Eq2(B) + (B, other') -> Lt2(B, other') + (this', B) -> Gt2(B, this') + (A, A) -> Eq2(A) + (A, other') -> Lt2(A, other') + (this', A) -> Gt2(A, this') + (S, S) -> Eq2(S) + +// Automatically generated. +// Shows a string representation of the `level` type. +pub fun level/show(this : level) : string + match this + G -> "G" + F -> "F" + E -> "E" + D -> "D" + C -> "C" + B -> "B" + A -> "A" + S -> "S" diff --git a/horse/spark.kk b/horse/spark.kk new file mode 100644 index 0000000..1a0daee --- /dev/null +++ b/horse/spark.kk @@ -0,0 +1,187 @@ +module horse/spark + +// A single spark. +// Parameterized by the spark type: stat, aptitude, unique, race, or skill. +pub struct spark + kind: a + level: level + +pub fun spark/show(spark: spark, level-fancy: string = "*", ?kind: (a) -> string): string + kind(spark.kind) ++ " " ++ spark.level.show ++ level-fancy + +pub type level + One + Two + Three + +pub fun level/show(this: level): string + match this + One -> "1" + Two -> "2" + Three -> "3" + +// Stat (blue) spark. +pub type stat + Speed + Stamina + Power + Guts + Wit + +// Automatically generated. +// Shows a string representation of the `stat` type. +pub fun stat/show(this : stat) : e string + match this + Speed -> "Speed" + Stamina -> "Stamina" + Power -> "Power" + Guts -> "Guts" + Wit -> "Wit" + +// Aptitude (red/pink) spark. +pub type aptitude + Turf + Dirt + Sprint + Mile + Medium + Long + Front-Runner + Pace-Chaser + Late-Surger + End-Closer + +// Shows a string representation of the `aptitude` type. +pub fun aptitude/show(this : aptitude): string + match this + Turf -> "Turf" + Dirt -> "Dirt" + Sprint -> "Sprint" + Mile -> "Mile" + Medium -> "Medium" + Long -> "Long" + Front-Runner -> "Front Runner" + Pace-Chaser -> "Pace Chaser" + Late-Surger -> "Late Surger" + End-Closer -> "End Closer" + +// Unique (green) spark. +// TODO: decide this representation; strings? umas? probably depends on skills generally +pub type unique + +pub fun unique/show(this: unique): string + "TODO(zeph): unique skills" + +// Race and scenario (white) sparks. +pub type race + Asahi-Hai-Futurity-Stakes + Hanshin-Juvenile-Fillies + Hopeful-Stakes + Oka-Sho + Satsuki-Sho + NHK-Mile-Cup + Japanese-Oaks + Japanese-Derby + Yasuda-Kinen + Takarazuka-Kinen + Japan-Dirt-Derby + Sprinters-Stakes + Kikuka-Sho + Shuka-Sho + Tenno-Sho-Autumn + JBC-Classic + JBC-Ladies-Classic + JBC-Sprint + Queen-Elizabeth-II-Cup + Japan-Cup + Mile-Championship + Champions-Cup + Arima-Kinen + Tokyo-Daishoten + February-Stakes + Osaka-Hai + Takamatsunomiya-Kinen + Tenno-Sho-Spring + Victoria-Mile + Teio-Sho + URA-Finale + Unity-Cup + +// Automatically generated. +// Equality comparison of the `race` type. +pub fip fun race/(==)(this : race, other : race) : bool + match (this, other) + (Asahi-Hai-Futurity-Stakes, Asahi-Hai-Futurity-Stakes) -> True + (Hanshin-Juvenile-Fillies, Hanshin-Juvenile-Fillies) -> True + (Hopeful-Stakes, Hopeful-Stakes) -> True + (Oka-Sho, Oka-Sho) -> True + (Satsuki-Sho, Satsuki-Sho) -> True + (NHK-Mile-Cup, NHK-Mile-Cup) -> True + (Japanese-Oaks, Japanese-Oaks) -> True + (Japanese-Derby, Japanese-Derby) -> True + (Yasuda-Kinen, Yasuda-Kinen) -> True + (Takarazuka-Kinen, Takarazuka-Kinen) -> True + (Japan-Dirt-Derby, Japan-Dirt-Derby) -> True + (Sprinters-Stakes, Sprinters-Stakes) -> True + (Kikuka-Sho, Kikuka-Sho) -> True + (Shuka-Sho, Shuka-Sho) -> True + (Tenno-Sho-Autumn, Tenno-Sho-Autumn) -> True + (JBC-Classic, JBC-Classic) -> True + (JBC-Ladies-Classic, JBC-Ladies-Classic) -> True + (JBC-Sprint, JBC-Sprint) -> True + (Queen-Elizabeth-II-Cup, Queen-Elizabeth-II-Cup) -> True + (Japan-Cup, Japan-Cup) -> True + (Mile-Championship, Mile-Championship) -> True + (Champions-Cup, Champions-Cup) -> True + (Arima-Kinen, Arima-Kinen) -> True + (Tokyo-Daishoten, Tokyo-Daishoten) -> True + (February-Stakes, February-Stakes) -> True + (Osaka-Hai, Osaka-Hai) -> True + (Takamatsunomiya-Kinen, Takamatsunomiya-Kinen) -> True + (Tenno-Sho-Spring, Tenno-Sho-Spring) -> True + (Victoria-Mile, Victoria-Mile) -> True + (Teio-Sho, Teio-Sho) -> True + (URA-Finale, URA-Finale) -> True + (Unity-Cup, Unity-Cup) -> True + (_, _) -> False + +// Automatically generated. +// Shows a string representation of the `race` type. +pub fip fun race/show(this : race) : string + match this + Asahi-Hai-Futurity-Stakes -> "Asahi Hai Futurity Stakes" + Hanshin-Juvenile-Fillies -> "Hanshin Juvenile Fillies" + Hopeful-Stakes -> "Hopeful Stakes" + Oka-Sho -> "Oka Sho" + Satsuki-Sho -> "Satsuki Sho" + NHK-Mile-Cup -> "NHK Mile Cup" + Japanese-Oaks -> "Japanese Oaks" + Japanese-Derby -> "Japanese Derby" + Yasuda-Kinen -> "Yasuda Kinen" + Takarazuka-Kinen -> "Takarazuka Kinen" + Japan-Dirt-Derby -> "Japan Dirt Derby" + Sprinters-Stakes -> "Sprinters Stakes" + Kikuka-Sho -> "Kikuka Sho" + Shuka-Sho -> "Shuka Sho" + Tenno-Sho-Autumn -> "Tenno Sho Autumn" + JBC-Classic -> "JBC Classic" + JBC-Ladies-Classic -> "JBC Ladies Classic" + JBC-Sprint -> "JBC Sprint" + Queen-Elizabeth-II-Cup -> "Queen Elizabeth II Cup" + Japan-Cup -> "Japan Cup" + Mile-Championship -> "Mile Championship" + Champions-Cup -> "Champions Cup" + Arima-Kinen -> "Arima Kinen" + Tokyo-Daishoten -> "Tokyo Daishoten" + February-Stakes -> "February Stakes" + Osaka-Hai -> "Osaka Hai" + Takamatsunomiya-Kinen -> "Takamatsunomiya Kinen" + Tenno-Sho-Spring -> "Tenno Sho Spring" + Victoria-Mile -> "Victoria Mile" + Teio-Sho -> "Teio Sho" + URA-Finale -> "URA Finale" + Unity-Cup -> "Unity Cup" + +// Skill (white) sparks. +// TODO: decide representation for skills; strings? actual real enumeration? +pub type skill diff --git a/std b/std new file mode 160000 index 0000000..f2e9e77 --- /dev/null +++ b/std @@ -0,0 +1 @@ +Subproject commit f2e9e778f08f3559b86624409bc100100a1a2e82