This commit is contained in:
2023-12-02 12:45:15 +01:00
parent 787691d640
commit b167933285
4 changed files with 87 additions and 0 deletions

17
day02/Part1.hs Normal file
View File

@@ -0,0 +1,17 @@
module Part1 where
import Commons
checkRoundsPossible :: [Round] -> Bool
checkRoundsPossible [] = True
checkRoundsPossible (round: t) = red round <= 12 && green round <= 13 && blue round <= 14 && (checkRoundsPossible t)
checkGamePossible :: Game -> Bool
checkGamePossible Game{rounds=rounds} = checkRoundsPossible rounds
getPossibleIds :: [Game] -> [Int]
getPossibleIds [] = []
getPossibleIds (game: t) = if (checkGamePossible game)
then (gid game: getPossibleIds t)
else do getPossibleIds t