Day 7
This commit is contained in:
15
day07/Part1.hs
Normal file
15
day07/Part1.hs
Normal file
@@ -0,0 +1,15 @@
|
||||
module Part1 where
|
||||
|
||||
import Commons
|
||||
import Data.List (sort, sortOn)
|
||||
|
||||
|
||||
getHandValue :: Hand -> HandValue
|
||||
getHandValue hand = HandValue {hand = hand, value = 100 ^ 5 * (getHandValueTypeFromSorted . sort) (values hand)
|
||||
+ getHandSecondValue (values hand)}
|
||||
|
||||
sortHands :: [Hand] -> [Hand]
|
||||
sortHands = map hand . sortHandValues . map getHandValue
|
||||
|
||||
getTotalWinnings :: [Hand] -> Int
|
||||
getTotalWinnings = getWinningsFromSorted 1 . sortHands
|
||||
Reference in New Issue
Block a user