diff options
author | brian <brianmchu42@gmail.com> | 2023-12-03 21:54:01 -0800 |
---|---|---|
committer | brian <brianmchu42@gmail.com> | 2023-12-03 21:54:01 -0800 |
commit | 7000f47b60b3fbdf90e2db12a363bbd1b2236b53 (patch) | |
tree | 13d9db09d3530f93d40afe1badf5da35c714a14d /bin/main.ml | |
download | AdventOfCode2023-7000f47b60b3fbdf90e2db12a363bbd1b2236b53.tar.gz |
add template for ocaml
Diffstat (limited to 'bin/main.ml')
-rw-r--r-- | bin/main.ml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/bin/main.ml b/bin/main.ml new file mode 100644 index 0000000..8e36c28 --- /dev/null +++ b/bin/main.ml @@ -0,0 +1,41 @@ +open Aoc +open Utils + +let () = + let args = Sys.argv in + let day = args.(1) in + let input_file = Printf.sprintf "inputs/%s.in" day in + if not @@ Caml.Sys.file_exists input_file then + download_input day input_file ; + let file = In_channel.open_text input_file in + let inputs = In_channel.input_all file in + let (module Day : Day.S) = + match day with + | "1" -> (module Day1) + | "2" -> (module Day2) + | "3" -> (module Day3) + | "4" -> (module Day4) + | "5" -> (module Day5) + | "6" -> (module Day6) + | "7" -> (module Day7) + | "8" -> (module Day8) + | "9" -> (module Day9) + | "10" -> (module Day10) + | "11" -> (module Day11) + | "12" -> (module Day12) + | "13" -> (module Day13) + | "14" -> (module Day14) + | "15" -> (module Day15) + | "16" -> (module Day16) + | "17" -> (module Day17) + | "18" -> (module Day18) + | "19" -> (module Day19) + | "20" -> (module Day20) + | "21" -> (module Day21) + | "22" -> (module Day22) + | "23" -> (module Day23) + | "24" -> (module Day24) + | "25" -> (module Day25) + | _ -> failwith "invalid day" + in + Day.run inputs ; In_channel.close file |