Play with syntax
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
module Part2 where
|
||||
|
||||
import Commons
|
||||
import Data.Function (on)
|
||||
|
||||
|
||||
getMinCubesRound :: [Round] -> Round
|
||||
getMinCubesRound [round] = round
|
||||
getMinCubesRound (round: otherRound: t) = getMinCubesRound (Round {red = max (red round) (red otherRound),
|
||||
green = max (green round) (green otherRound),
|
||||
blue = max (blue round) (blue otherRound)}: t)
|
||||
getMinCubesRound (round: otherRound: t) = getMinCubesRound $ Round {red = (max `on` red) round otherRound,
|
||||
green = (max `on` green) round otherRound,
|
||||
blue = (max `on` blue) round otherRound}: t
|
||||
|
||||
getPowerGame :: Game -> Int
|
||||
getPowerGame Game{rounds=rounds} = let minRound = getMinCubesRound rounds
|
||||
|
||||
Reference in New Issue
Block a user