diff --git a/horse/movement.kk b/horse/movement.kk index c2ffa4f..29bfbe5 100644 --- a/horse/movement.kk +++ b/horse/movement.kk @@ -53,8 +53,8 @@ pub fun style/show(this : style) : e string Late-Surger -> "Late Surger" End-Closer -> "End Closer" -// Starting aptitude levels. -pub type level +// Aptitude levels. +pub type aptitude-level G F E @@ -64,36 +64,38 @@ pub type level A S -// Automatically generated. -// Comparison of the `level` type. -pub fun level/cmp(this : level, other : level) : e order - match (this, other) - (G, G) -> Eq - (G, _) -> Lt - (_, G) -> Gt - (F, F) -> Eq - (F, _) -> Lt - (_, F) -> Gt - (E, E) -> Eq - (E, _) -> Lt - (_, E) -> Gt - (D, D) -> Eq - (D, _) -> Lt - (_, D) -> Gt - (C, C) -> Eq - (C, _) -> Lt - (_, C) -> Gt - (B, B) -> Eq - (B, _) -> Lt - (_, B) -> Gt - (A, A) -> Eq - (A, _) -> Lt - (_, A) -> Gt - (S, S) -> Eq +// Get the integer value for an aptitude level, starting at G -> 1. +pub fun aptitude-level/int(l: aptitude-level): int + match l + G -> 1 + F -> 2 + E -> 3 + D -> 4 + C -> 5 + B -> 6 + A -> 7 + S -> 8 + +// Get the aptitude level corresponding to an integer, starting at 1 -> G. +pub fun int/aptitude-level(l: int): maybe + match l + 1 -> Just(G) + 2 -> Just(F) + 3 -> Just(E) + 4 -> Just(D) + 5 -> Just(C) + 6 -> Just(B) + 7 -> Just(A) + 8 -> Just(S) + _ -> Nothing + +// Comparison of the `aptitude-level` type. +pub fun aptitude-level/cmp(this : aptitude-level, other : aptitude-level) : e order + cmp(this.int, other.int) // Automatically generated. -// Fip comparison of the `level` type. -pub fun level/order2(this : level, other : level) : order2 +// Fip comparison of the `aptitude-level` type. +pub fun aptitude-level/order2(this : aptitude-level, other : aptitude-level) : order2 match (this, other) (G, G) -> Eq2(G) (G, other') -> Lt2(G, other') @@ -119,8 +121,8 @@ pub fun level/order2(this : level, other : level) : order2 (S, S) -> Eq2(S) // Automatically generated. -// Shows a string representation of the `level` type. -pub fun level/show(this : level) : string +// Shows a string representation of the `aptitude-level` type. +pub fun aptitude-level/show(this : aptitude-level) : string match this G -> "G" F -> "F"