about summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/day.ml21
-rw-r--r--lib/day1.ml24
-rw-r--r--lib/day10.ml24
-rw-r--r--lib/day11.ml24
-rw-r--r--lib/day12.ml24
-rw-r--r--lib/day13.ml24
-rw-r--r--lib/day14.ml24
-rw-r--r--lib/day15.ml24
-rw-r--r--lib/day16.ml24
-rw-r--r--lib/day17.ml24
-rw-r--r--lib/day18.ml24
-rw-r--r--lib/day19.ml24
-rw-r--r--lib/day2.ml24
-rw-r--r--lib/day20.ml24
-rw-r--r--lib/day21.ml24
-rw-r--r--lib/day22.ml24
-rw-r--r--lib/day23.ml24
-rw-r--r--lib/day24.ml24
-rw-r--r--lib/day25.ml24
-rw-r--r--lib/day3.ml24
-rw-r--r--lib/day4.ml24
-rw-r--r--lib/day5.ml24
-rw-r--r--lib/day6.ml24
-rw-r--r--lib/day7.ml24
-rw-r--r--lib/day8.ml24
-rw-r--r--lib/day9.ml24
-rw-r--r--lib/day_template.ml24
-rw-r--r--lib/dune6
-rw-r--r--lib/imports.ml10
29 files changed, 661 insertions, 0 deletions
diff --git a/lib/day.ml b/lib/day.ml
new file mode 100644
index 0000000..ae5a2bd
--- /dev/null
+++ b/lib/day.ml
@@ -0,0 +1,21 @@
+module type S = sig
+  val run : ?only_part1:bool -> ?only_part2:bool -> string -> unit
+end
+
+module type Impl = sig
+  type t
+
+  val parse : string -> t
+
+  val part1 : t -> unit
+
+  val part2 : t -> unit
+end
+
+module Make (Impl : Impl) : S = struct
+  let run ?(only_part1 = false) ?(only_part2 = false) inputs =
+    let parsed = Impl.parse inputs in
+    let () = if not only_part2 then Impl.part1 parsed in
+    let () = if not only_part1 then Impl.part2 parsed in
+    ()
+end
diff --git a/lib/day1.ml b/lib/day1.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day1.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day10.ml b/lib/day10.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day10.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day11.ml b/lib/day11.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day11.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day12.ml b/lib/day12.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day12.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day13.ml b/lib/day13.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day13.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day14.ml b/lib/day14.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day14.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day15.ml b/lib/day15.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day15.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day16.ml b/lib/day16.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day16.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day17.ml b/lib/day17.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day17.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day18.ml b/lib/day18.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day18.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day19.ml b/lib/day19.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day19.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day2.ml b/lib/day2.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day2.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day20.ml b/lib/day20.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day20.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day21.ml b/lib/day21.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day21.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day22.ml b/lib/day22.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day22.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day23.ml b/lib/day23.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day23.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day24.ml b/lib/day24.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day24.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day25.ml b/lib/day25.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day25.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day3.ml b/lib/day3.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day3.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day4.ml b/lib/day4.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day4.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day5.ml b/lib/day5.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day5.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day6.ml b/lib/day6.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day6.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day7.ml b/lib/day7.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day7.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day8.ml b/lib/day8.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day8.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day9.ml b/lib/day9.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day9.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/day_template.ml b/lib/day_template.ml
new file mode 100644
index 0000000..5f433e2
--- /dev/null
+++ b/lib/day_template.ml
@@ -0,0 +1,24 @@
+open! Imports
+
+module M = struct
+  (* Type to parse the input into *)
+  type t = unit
+
+  (* Parse the input to type t, invoked for both parts *)
+  let parse _inputs = ()
+
+  (* Run part 1 with parsed inputs *)
+  let part1 _ = ()
+
+  (* Run part 2 with parsed inputs *)
+  let part2 _ = ()
+end
+
+include M
+include Day.Make (M)
+
+(* Example input *)
+let example = ""
+
+(* Expect test for example input *)
+let%expect_test _ = run example ; [%expect {| |}]
diff --git a/lib/dune b/lib/dune
new file mode 100644
index 0000000..ec706b4
--- /dev/null
+++ b/lib/dune
@@ -0,0 +1,6 @@
+(library
+ (name aoc)
+ (inline_tests)
+ (libraries unix)
+ (preprocess
+  (pps ppx_expect)))
diff --git a/lib/imports.ml b/lib/imports.ml
new file mode 100644
index 0000000..6d1617d
--- /dev/null
+++ b/lib/imports.ml
@@ -0,0 +1,10 @@
+(* Anything helper functions that would be imported for each module *)
+
+let print_endline_int i = print_endline (Int.to_string i)
+
+let time f =
+  let before = Unix.gettimeofday () in
+  let result = f () in
+  let after = Unix.gettimeofday () in
+  print_endline (Printf.sprintf "%f" (after -. before)) ;
+  result