39 lines
663 B
Haskell
39 lines
663 B
Haskell
|
module Game where
|
||
|
|
||
|
import Card
|
||
|
|
||
|
data Yaku =
|
||
|
Junk Int
|
||
|
| Ribbons Int
|
||
|
| SpecialRibbons Int
|
||
|
| Animals Int
|
||
|
| InoShikaCho
|
||
|
| Sake Int
|
||
|
| Lights Int
|
||
|
|
||
|
data Taken = Taken {
|
||
|
junk :: [ Flower ]
|
||
|
, animals :: [ Animal ]
|
||
|
, ribbons :: [ Ribbon ]
|
||
|
, lights :: [ Light ]
|
||
|
}
|
||
|
|
||
|
data Player = Player {
|
||
|
hand :: [ Card ]
|
||
|
, taken :: Taken
|
||
|
}
|
||
|
|
||
|
score :: Yaku -> Int
|
||
|
score (Junk n) = 1 + n
|
||
|
score (Ribbons n) = 1 + n
|
||
|
score (SpecialRibbons 0) = 3
|
||
|
score (SpecialRibbons _) = 9
|
||
|
score (Animals n) = 1 + n
|
||
|
score InoShikaCho = 5
|
||
|
score (Sake 0) = 5
|
||
|
score (Sake _) = 15
|
||
|
score (Lights 0) = 5
|
||
|
score (Lights 1) = 8
|
||
|
score (Lights 2) = 10
|
||
|
score (Lights 3) = 15
|