initial representation of uma and sparks

This commit is contained in:
2026-01-01 19:26:57 -05:00
commit 7dcf6bca6a
5 changed files with 263 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.koka
.vscode

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "std"]
path = std
url = git@github.com:koka-community/std.git

70
horse/horse.kk Normal file
View File

@@ -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<level, float64>
// 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<level>
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"

187
horse/spark.kk Normal file
View File

@@ -0,0 +1,187 @@
module horse/spark
// A single spark.
// Parameterized by the spark type: stat, aptitude, unique, race, or skill.
pub struct spark<a>
kind: a
level: level
pub fun spark/show(spark: spark<a>, 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

1
std Submodule

Submodule std added at f2e9e778f0