Play with syntax

This commit is contained in:
2023-12-04 19:05:20 +01:00
parent e746e22b0b
commit 53cad097f8
15 changed files with 27 additions and 26 deletions

View File

@@ -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