18 lines
548 B
Haskell
18 lines
548 B
Haskell
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 getPossibleIds t
|