Implement card capture (さくら!)
This commit is contained in:
parent
c95d611024
commit
b03e97bb81
1 changed files with 6 additions and 0 deletions
|
@ -92,3 +92,9 @@ yakus = foldl (\map -> unionWith (++) map . index) empty [
|
|||
, ([SakeCup, FullMoon], fixed (TsukimiZake, 5))
|
||||
, ([SakeCup, CampCurtain], fixed (HanamiZake, 5))
|
||||
]
|
||||
|
||||
capture :: State -> Card -> Pack -> (Pack, Score)
|
||||
capture (State {month}) card pack =
|
||||
let newPack = add pack card in
|
||||
let yakuFinders = (unionWith (++) yakus . index $ tsukiFuda month) ! card in
|
||||
(newPack, foldl (\score -> foldr (uncurry insert) score . ($newPack)) empty yakuFinders)
|
||||
|
|
Loading…
Reference in a new issue