open Base let main() = let source = Stdio.In_channel.read_all "input" in let map = Lib.parse_map (String.strip source) in let count = Lib.count_trees_in_slope map (3, 1) in let all_counts = List.map ~f:(Lib.count_trees_in_slope map) Lib.all_slopes in let product = List.fold ~init:1 ~f:(fun x y -> x * y) all_counts in Stdio.printf "part one: you would hit %d trees\n" count; Stdio.printf "part two: you would hit %d trees\n" product let () = main()