It took me the afternoon but I got a LSP working

This commit is contained in:
2023-12-02 16:16:57 +01:00
parent a36a4ccbe9
commit eedd910d67
8 changed files with 35 additions and 31 deletions

View File

@@ -4,15 +4,14 @@ import Commons
getMinCubesRound :: [Round] -> Round
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)
getPowerGame :: Game -> Int
getPowerGame Game{rounds=rounds} = let minRound = getMinCubesRound rounds
in (red minRound) * (green minRound) * (blue minRound)
in red minRound * green minRound * blue minRound
getPower :: [Game] -> [Int]
getPower [] = []
getPower (game: t) = (getPowerGame game: getPower t)
getPower = map getPowerGame