tweaks to playground files

This commit is contained in:
2024-11-25 16:25:05 -08:00
parent acb37a2882
commit 6f954b1183
4 changed files with 36 additions and 67 deletions

View File

@@ -82,18 +82,20 @@ part2 (MkGame n parts :: rest) =
case foldl maxd (0,0,0) parts of
(a,b,c) => a * b * c + part2 rest
run : String -> IO Unit
run fn = do
text <- readFile fn
case mapM parseGame (split (trim text) "\n") of
Left err => putStrLn $ "fail " ++ err
Right games => do
putStrLn "part1"
printLn (part1 games)
putStrLn "part2"
printLn (part2 games)
-- readFile not in browser / playground
main : IO Unit
main = do
run "aoc2023/day2/eg.txt"
run "aoc2023/day2/input.txt"
-- run : String -> IO Unit
-- run fn = do
-- text <- readFile fn
-- case mapM parseGame (split (trim text) "\n") of
-- Left err => putStrLn $ "fail " ++ err
-- Right games => do
-- putStrLn "part1"
-- printLn (part1 games)
-- putStrLn "part2"
-- printLn (part2 games)
-- main : IO Unit
-- main = do
-- run "aoc2023/day2/eg.txt"
-- run "aoc2023/day2/input.txt"