--- Writeup at https://work.njae.me.uk/2023/12/08/advent-of-code-2023-day-8/
+-- Writeup at https://work.njae.me.uk/2023/12/15/advent-of-code-2023-day-12/
import AoC
import Data.Text (Text)
| length xs == n - 1 = [(x:xs)]
| otherwise = (fmap (x:) (choose (n-1) xs)) ++ (choose n xs)
--- unknownIndices :: [Spring] -> [Int]
--- unknownIndices = elemIndices Unknown
-
numDamagedToPlace :: Record -> Int
numDamagedToPlace (Record springs signature) = totalDamaged - knownDamaged
where knownDamaged = length $ filter (== Damaged) springs
springP :: Parser Spring
recordsP = recordP `sepBy` endOfLine
-recordP = Record <$> (many1 springP <* " ") <*> (decimal `sepBy` ",")
+recordP = Record <$> many1 springP <* " " <*> decimal `sepBy` ","
springP = (Unknown <$ "?") <|> (Damaged <$ "#") <|> (Operational <$ ".")
successfulParse :: Text -> [Record]