diff --git a/KoiKoi.hs b/KoiKoi.hs index c261b7f..3618ead 100644 --- a/KoiKoi.hs +++ b/KoiKoi.hs @@ -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)