diff options
author | Santo Cariotti <santo@dcariotti.me> | 2024-02-09 11:42:04 +0100 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2024-02-09 11:42:04 +0100 |
commit | db2686c798378738020a0951a521358586e21aa0 (patch) | |
tree | 8d585ceb9bdc302ae10a2458cc343be40d60acb7 /2023/ocaml | |
parent | 67dff579e91c13ef40ecb17d14497d145861c5e7 (diff) |
Add day2 in OCaml
Diffstat (limited to '2023/ocaml')
34 files changed, 248 insertions, 0 deletions
diff --git a/2023/ocaml/day2/_build/.db b/2023/ocaml/day2/_build/.db Binary files differnew file mode 100644 index 0000000..9629230 --- /dev/null +++ b/2023/ocaml/day2/_build/.db diff --git a/2023/ocaml/day2/_build/.digest-db b/2023/ocaml/day2/_build/.digest-db Binary files differnew file mode 100644 index 0000000..0c7bdb2 --- /dev/null +++ b/2023/ocaml/day2/_build/.digest-db diff --git a/2023/ocaml/day2/_build/.filesystem-clock b/2023/ocaml/day2/_build/.filesystem-clock new file mode 100644 index 0000000..c61f4a7 --- /dev/null +++ b/2023/ocaml/day2/_build/.filesystem-clock @@ -0,0 +1 @@ +<dummy>
\ No newline at end of file diff --git a/2023/ocaml/day2/_build/.lock b/2023/ocaml/day2/_build/.lock new file mode 100644 index 0000000..5f977d9 --- /dev/null +++ b/2023/ocaml/day2/_build/.lock @@ -0,0 +1 @@ +12823
\ No newline at end of file diff --git a/2023/ocaml/day2/_build/default/.dune/configurator b/2023/ocaml/day2/_build/default/.dune/configurator new file mode 100644 index 0000000..2df6f9a --- /dev/null +++ b/2023/ocaml/day2/_build/default/.dune/configurator @@ -0,0 +1,2 @@ +(ocamlc /home/santo/.opam/default/bin/ocamlc.opt) +(ocaml_config_vars (afl_instrument false) (architecture amd64) (asm as) (asm_cfi_supported true) (ast_impl_magic_number Caml1999M033) (ast_intf_magic_number Caml1999N033) (bytecomp_c_compiler "gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_FILE_OFFSET_BITS=64 ") (bytecomp_c_libraries " -lm -lpthread") (c_compiler gcc) (ccomp_type cc) (cma_magic_number Caml1999A033) (cmi_magic_number Caml1999I033) (cmo_magic_number Caml1999O033) (cmt_magic_number Caml1999T033) (cmx_magic_number Caml1999Y033) (cmxa_magic_number Caml1999Z033) (cmxs_magic_number Caml1999D033) (compression_supported false) (default_executable_name a.out) (default_safe_string true) (exec_magic_number Caml1999X033) (ext_asm .s) (ext_dll .so) (ext_exe "") (ext_lib .a) (ext_obj .o) (flambda false) (flat_float_array true) (function_sections true) (host x86_64-pc-linux-gnu) (int_size 63) (linear_magic_number Caml1999L033) (model default) (naked_pointers false) (native_c_compiler "gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_FILE_OFFSET_BITS=64 ") (native_c_libraries " -lm -lpthread") (native_compiler true) (native_dynlink true) (native_pack_linker "ld -r -o ") (ocamlc_cflags "-O2 -fno-strict-aliasing -fwrapv -pthread -fPIC ") (ocamlc_cppflags " -D_FILE_OFFSET_BITS=64 ") (ocamlopt_cflags "-O2 -fno-strict-aliasing -fwrapv -pthread -fPIC ") (ocamlopt_cppflags " -D_FILE_OFFSET_BITS=64 ") (os_type Unix) (safe_string true) (standard_library /home/santo/.opam/default/lib/ocaml) (standard_library_default /home/santo/.opam/default/lib/ocaml) (supports_shared_libraries true) (system linux) (systhread_supported true) (target x86_64-pc-linux-gnu) (version 5.1.0) (windows_unicode false) (with_frame_pointers false) (word_size 64)) diff --git a/2023/ocaml/day2/_build/default/.dune/configurator.v2 b/2023/ocaml/day2/_build/default/.dune/configurator.v2 new file mode 100644 index 0000000..3edd1f2 --- /dev/null +++ b/2023/ocaml/day2/_build/default/.dune/configurator.v2 @@ -0,0 +1 @@ +((6:ocamlc40:/home/santo/.opam/default/bin/ocamlc.opt)(17:ocaml_config_vars((14:afl_instrument5:false)(12:architecture5:amd64)(3:asm2:as)(17:asm_cfi_supported4:true)(21:ast_impl_magic_number12:Caml1999M033)(21:ast_intf_magic_number12:Caml1999N033)(19:bytecomp_c_compiler77:gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_FILE_OFFSET_BITS=64 )(20:bytecomp_c_libraries15: -lm -lpthread)(10:c_compiler3:gcc)(10:ccomp_type2:cc)(16:cma_magic_number12:Caml1999A033)(16:cmi_magic_number12:Caml1999I033)(16:cmo_magic_number12:Caml1999O033)(16:cmt_magic_number12:Caml1999T033)(16:cmx_magic_number12:Caml1999Y033)(17:cmxa_magic_number12:Caml1999Z033)(17:cmxs_magic_number12:Caml1999D033)(21:compression_supported5:false)(23:default_executable_name5:a.out)(19:default_safe_string4:true)(17:exec_magic_number12:Caml1999X033)(7:ext_asm2:.s)(7:ext_dll3:.so)(7:ext_exe0:)(7:ext_lib2:.a)(7:ext_obj2:.o)(7:flambda5:false)(16:flat_float_array4:true)(17:function_sections4:true)(4:host19:x86_64-pc-linux-gnu)(8:int_size2:63)(19:linear_magic_number12:Caml1999L033)(5:model7:default)(14:naked_pointers5:false)(17:native_c_compiler77:gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_FILE_OFFSET_BITS=64 )(18:native_c_libraries15: -lm -lpthread)(15:native_compiler4:true)(14:native_dynlink4:true)(18:native_pack_linker9:ld -r -o )(13:ocamlc_cflags48:-O2 -fno-strict-aliasing -fwrapv -pthread -fPIC )(15:ocamlc_cppflags24: -D_FILE_OFFSET_BITS=64 )(15:ocamlopt_cflags48:-O2 -fno-strict-aliasing -fwrapv -pthread -fPIC )(17:ocamlopt_cppflags24: -D_FILE_OFFSET_BITS=64 )(7:os_type4:Unix)(11:safe_string4:true)(16:standard_library35:/home/santo/.opam/default/lib/ocaml)(24:standard_library_default35:/home/santo/.opam/default/lib/ocaml)(25:supports_shared_libraries4:true)(6:system5:linux)(19:systhread_supported4:true)(6:target19:x86_64-pc-linux-gnu)(7:version5:5.1.0)(15:windows_unicode5:false)(19:with_frame_pointers5:false)(9:word_size2:64))))
\ No newline at end of file diff --git a/2023/ocaml/day2/_build/default/bin/.main.eobjs/byte/dune__exe__Main.cmi b/2023/ocaml/day2/_build/default/bin/.main.eobjs/byte/dune__exe__Main.cmi Binary files differnew file mode 100644 index 0000000..1886df9 --- /dev/null +++ b/2023/ocaml/day2/_build/default/bin/.main.eobjs/byte/dune__exe__Main.cmi diff --git a/2023/ocaml/day2/_build/default/bin/.main.eobjs/byte/dune__exe__Main.cmti b/2023/ocaml/day2/_build/default/bin/.main.eobjs/byte/dune__exe__Main.cmti Binary files differnew file mode 100644 index 0000000..87d60ff --- /dev/null +++ b/2023/ocaml/day2/_build/default/bin/.main.eobjs/byte/dune__exe__Main.cmti diff --git a/2023/ocaml/day2/_build/default/bin/.main.eobjs/native/dune__exe__Main.cmx b/2023/ocaml/day2/_build/default/bin/.main.eobjs/native/dune__exe__Main.cmx Binary files differnew file mode 100644 index 0000000..fdc4cf6 --- /dev/null +++ b/2023/ocaml/day2/_build/default/bin/.main.eobjs/native/dune__exe__Main.cmx diff --git a/2023/ocaml/day2/_build/default/bin/.main.eobjs/native/dune__exe__Main.o b/2023/ocaml/day2/_build/default/bin/.main.eobjs/native/dune__exe__Main.o Binary files differnew file mode 100644 index 0000000..7bbc169 --- /dev/null +++ b/2023/ocaml/day2/_build/default/bin/.main.eobjs/native/dune__exe__Main.o diff --git a/2023/ocaml/day2/_build/default/bin/.merlin-conf/exe-main b/2023/ocaml/day2/_build/default/bin/.merlin-conf/exe-main Binary files differnew file mode 100644 index 0000000..647fe64 --- /dev/null +++ b/2023/ocaml/day2/_build/default/bin/.merlin-conf/exe-main diff --git a/2023/ocaml/day2/_build/default/bin/main.exe b/2023/ocaml/day2/_build/default/bin/main.exe Binary files differnew file mode 100755 index 0000000..1b3c926 --- /dev/null +++ b/2023/ocaml/day2/_build/default/bin/main.exe diff --git a/2023/ocaml/day2/_build/default/bin/main.ml b/2023/ocaml/day2/_build/default/bin/main.ml new file mode 100644 index 0000000..6dba854 --- /dev/null +++ b/2023/ocaml/day2/_build/default/bin/main.ml @@ -0,0 +1,39 @@ +let input_file = "input.txt" + +let read_file f = + let ic = open_in f in + try + let lines = really_input_string ic (in_channel_length ic) in + let lines = String.trim lines in + close_in ic ; + lines + with e -> + close_in_noerr ic; + raise e + +let rec parse ?(result=0) body = + match body with + | [] -> result + | x :: tail -> + let plays = String.split_on_char ':' x + |> List.rev + |> List.hd + |> String.split_on_char ';' + |> List.map (String.split_on_char ',') + |> List.map (List.map @@ String.trim) + |> List.map (List.map (fun x -> (List.hd (String.split_on_char ' ' x) |> int_of_string, String.get (List.nth (String.split_on_char ' ' x) 1 ) 0))) + in + + + let points = List.map (List.map (fun (p,c) -> if (c = 'r' && p > 12) || (c = 'g' && p > 13) || (c = 'b' && p > 14) then 0 else 1)) plays in + let add = if List.length (List.filter (fun x -> List.length x > 0) @@ List.map (List.filter (fun x -> x = 0)) points) = 0 then + String.split_on_char ':' x |> List.hd |> String.split_on_char ' ' |> List.rev |> List.hd |> int_of_string + else + 0 in + + parse tail ~result:(result+add) + + +let () = + let result = parse (String.split_on_char '\n' (read_file input_file)) in + Printf.printf "%d" result diff --git a/2023/ocaml/day2/_build/default/bin/main.mli b/2023/ocaml/day2/_build/default/bin/main.mli new file mode 100644 index 0000000..335ae1f --- /dev/null +++ b/2023/ocaml/day2/_build/default/bin/main.mli @@ -0,0 +1 @@ +(* Auto-generated by Dune *)
\ No newline at end of file diff --git a/2023/ocaml/day2/_build/default/lib/.day2.objs/byte/day2.cmi b/2023/ocaml/day2/_build/default/lib/.day2.objs/byte/day2.cmi Binary files differnew file mode 100644 index 0000000..7806bc1 --- /dev/null +++ b/2023/ocaml/day2/_build/default/lib/.day2.objs/byte/day2.cmi diff --git a/2023/ocaml/day2/_build/default/lib/.day2.objs/byte/day2.cmo b/2023/ocaml/day2/_build/default/lib/.day2.objs/byte/day2.cmo Binary files differnew file mode 100644 index 0000000..72a7297 --- /dev/null +++ b/2023/ocaml/day2/_build/default/lib/.day2.objs/byte/day2.cmo diff --git a/2023/ocaml/day2/_build/default/lib/.day2.objs/byte/day2.cmt b/2023/ocaml/day2/_build/default/lib/.day2.objs/byte/day2.cmt Binary files differnew file mode 100644 index 0000000..ead5d30 --- /dev/null +++ b/2023/ocaml/day2/_build/default/lib/.day2.objs/byte/day2.cmt diff --git a/2023/ocaml/day2/_build/default/lib/.day2.objs/native/day2.cmx b/2023/ocaml/day2/_build/default/lib/.day2.objs/native/day2.cmx Binary files differnew file mode 100644 index 0000000..23b029c --- /dev/null +++ b/2023/ocaml/day2/_build/default/lib/.day2.objs/native/day2.cmx diff --git a/2023/ocaml/day2/_build/default/lib/.day2.objs/native/day2.o b/2023/ocaml/day2/_build/default/lib/.day2.objs/native/day2.o Binary files differnew file mode 100644 index 0000000..59dab7d --- /dev/null +++ b/2023/ocaml/day2/_build/default/lib/.day2.objs/native/day2.o diff --git a/2023/ocaml/day2/_build/default/lib/.merlin-conf/lib-day2 b/2023/ocaml/day2/_build/default/lib/.merlin-conf/lib-day2 Binary files differnew file mode 100644 index 0000000..df37a97 --- /dev/null +++ b/2023/ocaml/day2/_build/default/lib/.merlin-conf/lib-day2 diff --git a/2023/ocaml/day2/_build/default/lib/day2.a b/2023/ocaml/day2/_build/default/lib/day2.a Binary files differnew file mode 100644 index 0000000..b7e4559 --- /dev/null +++ b/2023/ocaml/day2/_build/default/lib/day2.a diff --git a/2023/ocaml/day2/_build/default/lib/day2.cmxa b/2023/ocaml/day2/_build/default/lib/day2.cmxa Binary files differnew file mode 100644 index 0000000..b2af724 --- /dev/null +++ b/2023/ocaml/day2/_build/default/lib/day2.cmxa diff --git a/2023/ocaml/day2/_build/default/lib/day2.ml-gen b/2023/ocaml/day2/_build/default/lib/day2.ml-gen new file mode 100644 index 0000000..71d4a7c --- /dev/null +++ b/2023/ocaml/day2/_build/default/lib/day2.ml-gen @@ -0,0 +1 @@ +(* generated by dune *) diff --git a/2023/ocaml/day2/_build/install/default/bin/day2 b/2023/ocaml/day2/_build/install/default/bin/day2 new file mode 120000 index 0000000..9cc466a --- /dev/null +++ b/2023/ocaml/day2/_build/install/default/bin/day2 @@ -0,0 +1 @@ +../../../default/bin/main.exe
\ No newline at end of file diff --git a/2023/ocaml/day2/_build/log b/2023/ocaml/day2/_build/log new file mode 100644 index 0000000..142f06e --- /dev/null +++ b/2023/ocaml/day2/_build/log @@ -0,0 +1,23 @@ +# dune exec day2 +# OCAMLPARAM: unset +# Shared cache: disabled +# Shared cache location: /home/santo/.cache/dune/db +# Workspace root: /home/santo/code/aoc/2023/ocaml/day2 +# Auto-detected concurrency: 8 +# Dune context: +# { name = "default" +# ; kind = "default" +# ; profile = Dev +# ; merlin = true +# ; fdo_target_exe = None +# ; build_dir = In_build_dir "default" +# ; installed_env = +# map +# { "INSIDE_DUNE" : +# "/home/santo/code/aoc/2023/ocaml/day2/_build/default" +# ; "OCAML_COLOR" : "always" +# ; "OPAMCOLOR" : "always" +# } +# ; instrument_with = [] +# } +$ /home/santo/.opam/default/bin/ocamlc.opt -config > /tmp/dune_e1b366_output diff --git a/2023/ocaml/day2/bin/dune b/2023/ocaml/day2/bin/dune new file mode 100644 index 0000000..1fdd987 --- /dev/null +++ b/2023/ocaml/day2/bin/dune @@ -0,0 +1,4 @@ +(executable + (public_name day2) + (name main) + (libraries day2)) diff --git a/2023/ocaml/day2/bin/main.ml b/2023/ocaml/day2/bin/main.ml new file mode 100644 index 0000000..6dba854 --- /dev/null +++ b/2023/ocaml/day2/bin/main.ml @@ -0,0 +1,39 @@ +let input_file = "input.txt" + +let read_file f = + let ic = open_in f in + try + let lines = really_input_string ic (in_channel_length ic) in + let lines = String.trim lines in + close_in ic ; + lines + with e -> + close_in_noerr ic; + raise e + +let rec parse ?(result=0) body = + match body with + | [] -> result + | x :: tail -> + let plays = String.split_on_char ':' x + |> List.rev + |> List.hd + |> String.split_on_char ';' + |> List.map (String.split_on_char ',') + |> List.map (List.map @@ String.trim) + |> List.map (List.map (fun x -> (List.hd (String.split_on_char ' ' x) |> int_of_string, String.get (List.nth (String.split_on_char ' ' x) 1 ) 0))) + in + + + let points = List.map (List.map (fun (p,c) -> if (c = 'r' && p > 12) || (c = 'g' && p > 13) || (c = 'b' && p > 14) then 0 else 1)) plays in + let add = if List.length (List.filter (fun x -> List.length x > 0) @@ List.map (List.filter (fun x -> x = 0)) points) = 0 then + String.split_on_char ':' x |> List.hd |> String.split_on_char ' ' |> List.rev |> List.hd |> int_of_string + else + 0 in + + parse tail ~result:(result+add) + + +let () = + let result = parse (String.split_on_char '\n' (read_file input_file)) in + Printf.printf "%d" result diff --git a/2023/ocaml/day2/day2.opam b/2023/ocaml/day2/day2.opam new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/2023/ocaml/day2/day2.opam diff --git a/2023/ocaml/day2/dune-project b/2023/ocaml/day2/dune-project new file mode 100644 index 0000000..1341555 --- /dev/null +++ b/2023/ocaml/day2/dune-project @@ -0,0 +1,26 @@ +(lang dune 3.12) + +(name day2) + +(generate_opam_files true) + +(source + (github username/reponame)) + +(authors "Author Name") + +(maintainers "Maintainer Name") + +(license LICENSE) + +(documentation https://url/to/documentation) + +(package + (name day2) + (synopsis "A short synopsis") + (description "A longer description") + (depends ocaml dune) + (tags + (topics "to describe" your project))) + +; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project diff --git a/2023/ocaml/day2/example.txt b/2023/ocaml/day2/example.txt new file mode 100644 index 0000000..295c36d --- /dev/null +++ b/2023/ocaml/day2/example.txt @@ -0,0 +1,5 @@ +Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green +Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue +Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red +Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red +Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green diff --git a/2023/ocaml/day2/input.txt b/2023/ocaml/day2/input.txt new file mode 100644 index 0000000..249bfe4 --- /dev/null +++ b/2023/ocaml/day2/input.txt @@ -0,0 +1,100 @@ +Game 1: 18 red, 8 green, 7 blue; 15 red, 4 blue, 1 green; 2 green, 17 red, 6 blue; 5 green, 1 blue, 11 red; 18 red, 1 green, 14 blue; 8 blue +Game 2: 16 blue, 12 green, 3 red; 13 blue, 2 red, 8 green; 15 green, 3 red, 16 blue +Game 3: 6 green, 15 red; 1 green, 4 red, 7 blue; 9 blue, 7 red, 8 green +Game 4: 8 red, 2 blue; 11 red, 5 blue, 1 green; 12 red, 1 green, 5 blue; 1 blue; 2 blue, 9 red +Game 5: 9 blue, 3 red, 12 green; 3 green, 4 red, 17 blue; 15 blue, 2 green, 5 red; 3 blue, 5 green, 6 red; 6 red, 4 blue, 7 green; 3 green, 10 blue +Game 6: 11 red, 2 blue, 6 green; 2 blue, 9 red, 4 green; 3 blue, 12 red, 8 green; 5 red, 11 green, 4 blue; 2 blue, 9 red, 13 green; 15 red, 3 blue, 7 green +Game 7: 2 red, 9 green, 12 blue; 14 blue, 1 green, 6 red; 7 blue, 9 green; 9 green, 8 red, 4 blue; 5 red, 3 green, 16 blue; 4 red, 8 green +Game 8: 11 red, 12 green, 1 blue; 4 red, 7 green; 11 red, 6 green; 17 green; 15 green, 1 red +Game 9: 1 red, 1 green, 12 blue; 3 green, 12 red, 6 blue; 14 red, 1 blue; 9 blue, 1 red, 3 green +Game 10: 1 red, 4 blue; 3 blue, 4 green; 3 green, 3 red, 8 blue; 2 blue, 3 red; 3 green, 4 red, 3 blue +Game 11: 8 blue, 1 red; 8 green, 1 red, 1 blue; 13 green, 9 red, 6 blue +Game 12: 2 red, 2 blue, 1 green; 3 red, 1 green; 1 blue, 3 green +Game 13: 12 green, 4 blue; 2 red, 2 blue, 8 green; 6 green, 3 red; 3 red, 5 green; 9 green, 7 blue, 1 red +Game 14: 1 red, 7 green; 5 green, 12 red, 10 blue; 9 red, 11 blue, 7 green; 7 blue, 3 red, 9 green +Game 15: 7 green, 1 blue; 1 red, 2 green, 1 blue; 7 green +Game 16: 1 green, 1 blue; 2 blue, 4 green, 2 red; 2 green, 2 blue +Game 17: 6 red, 11 green, 7 blue; 1 blue, 13 green, 4 red; 4 green, 6 blue, 7 red +Game 18: 2 red, 8 blue; 7 red, 11 blue; 1 green, 16 blue, 7 red; 18 blue, 1 green, 14 red +Game 19: 2 red, 2 blue; 1 green, 6 red; 1 green, 3 red, 2 blue +Game 20: 6 red, 2 blue, 5 green; 4 red, 1 blue, 9 green; 3 blue, 2 red, 9 green; 8 red, 12 green, 5 blue +Game 21: 6 red, 7 blue; 3 blue, 16 red, 2 green; 2 blue, 13 red; 3 blue, 11 red, 3 green; 1 green, 18 red, 6 blue; 12 red, 5 blue, 2 green +Game 22: 9 red, 6 blue, 14 green; 1 blue, 5 green, 13 red; 6 red; 18 red, 4 green; 2 blue, 10 green, 16 red; 1 red, 18 green, 1 blue +Game 23: 6 green, 4 red, 3 blue; 1 blue, 2 red, 9 green; 5 green, 1 red, 3 blue; 5 blue, 4 red, 4 green +Game 24: 1 red, 5 green, 2 blue; 4 red, 7 green, 9 blue; 9 blue, 7 green; 7 green, 13 blue; 4 blue, 1 green, 4 red +Game 25: 13 blue, 10 red, 11 green; 10 green, 1 blue, 3 red; 15 red, 5 green, 8 blue; 19 red, 10 green, 13 blue; 12 blue, 4 green, 16 red; 7 red, 5 green, 9 blue +Game 26: 20 red, 6 blue, 12 green; 15 blue, 17 red, 9 green; 19 red, 6 green, 3 blue; 8 green, 1 red, 15 blue; 10 green, 8 red, 5 blue; 4 green, 20 red, 18 blue +Game 27: 2 blue, 3 green, 7 red; 2 blue, 4 red; 5 blue, 5 green; 8 blue, 6 green, 2 red +Game 28: 1 green, 6 red; 3 red, 3 blue; 1 green, 4 red; 1 red, 2 blue; 2 red +Game 29: 8 blue, 1 green; 7 blue, 1 red; 6 red, 2 blue; 2 red, 3 green; 3 red, 6 green, 5 blue +Game 30: 11 blue, 17 green, 10 red; 9 blue, 12 green, 14 red; 16 green, 2 red, 8 blue; 18 green, 1 red, 1 blue; 5 blue, 7 red, 18 green; 9 green, 3 blue, 11 red +Game 31: 5 blue, 13 green; 2 green, 3 red, 4 blue; 3 red, 15 green, 2 blue; 5 blue, 19 green; 5 blue, 18 green; 3 green, 7 blue, 3 red +Game 32: 12 red, 2 green, 3 blue; 2 green, 16 red, 1 blue; 13 red, 4 green, 6 blue +Game 33: 18 green, 8 blue, 3 red; 15 green, 2 blue, 4 red; 14 blue, 3 red, 6 green; 20 green, 13 blue; 1 red, 19 green +Game 34: 1 green, 7 blue, 2 red; 8 green, 10 blue, 2 red; 3 blue, 1 green, 1 red; 6 green, 13 blue, 1 red; 1 green, 4 blue, 2 red; 1 red, 5 green, 7 blue +Game 35: 7 blue, 8 red; 2 blue, 3 red; 4 blue, 3 red; 7 red, 4 blue; 1 blue, 1 green, 3 red +Game 36: 1 red, 8 green; 1 red, 6 green; 3 green, 8 red; 1 blue, 2 red, 1 green +Game 37: 3 blue, 13 red; 2 blue, 7 red; 5 red, 1 green; 3 red, 3 blue; 1 blue, 12 red, 1 green; 14 red, 3 blue +Game 38: 7 blue, 18 red, 12 green; 11 red, 6 green, 1 blue; 9 green, 1 red; 9 green, 13 blue, 16 red +Game 39: 12 red, 3 green, 2 blue; 3 blue, 3 green, 10 red; 2 blue, 5 red; 2 blue, 1 green; 5 blue, 4 green, 7 red; 2 green, 1 red +Game 40: 1 red, 7 blue, 5 green; 1 red, 4 blue, 8 green; 3 red, 5 blue, 14 green; 10 green, 2 blue, 1 red; 11 blue, 7 green, 1 red; 14 green, 2 blue +Game 41: 8 green, 5 red, 3 blue; 5 red, 4 blue, 12 green; 10 green, 6 blue; 13 green, 7 blue; 1 red, 2 green, 15 blue +Game 42: 17 red, 1 blue, 5 green; 9 green, 16 red; 1 blue, 15 green, 2 red; 1 blue, 12 red, 12 green +Game 43: 12 green, 5 blue; 3 red, 8 blue, 10 green; 8 blue, 2 green, 1 red +Game 44: 1 green, 7 red, 2 blue; 1 blue, 10 red; 4 green, 3 blue, 19 red; 1 blue, 3 green, 1 red; 1 blue; 4 red, 2 green, 3 blue +Game 45: 16 red, 12 blue, 1 green; 13 blue, 16 red, 9 green; 7 green, 3 red, 8 blue +Game 46: 1 red, 17 green, 6 blue; 6 blue, 1 red, 3 green; 12 green, 1 blue; 4 blue, 2 green +Game 47: 2 green, 12 red, 15 blue; 9 blue, 2 green, 2 red; 3 green, 6 blue, 2 red; 11 blue, 3 green, 5 red; 6 green, 9 red, 17 blue +Game 48: 5 blue, 6 red; 7 green, 14 red, 4 blue; 2 green, 5 blue, 2 red; 11 blue, 5 red, 5 green +Game 49: 7 green, 7 blue, 4 red; 11 green, 12 blue, 2 red; 12 blue, 4 red, 9 green; 3 red, 8 blue, 17 green; 16 green, 3 red, 14 blue +Game 50: 5 green, 4 red, 10 blue; 7 green, 14 red, 5 blue; 12 red, 18 blue, 14 green +Game 51: 12 green, 3 blue; 10 green, 4 blue, 2 red; 3 green, 5 blue +Game 52: 12 green, 6 red, 7 blue; 20 green, 6 red, 18 blue; 1 green, 5 blue, 11 red; 2 green, 15 blue, 6 red +Game 53: 6 red, 2 green, 5 blue; 13 green, 1 blue, 14 red; 7 green, 1 blue; 3 green, 4 blue, 6 red; 10 red, 6 green, 4 blue +Game 54: 4 blue, 1 red; 1 red, 1 blue, 9 green; 3 red, 2 blue, 4 green; 3 green, 2 red, 5 blue; 9 blue, 2 red, 7 green +Game 55: 7 blue; 6 blue, 1 red; 4 red, 7 blue; 3 red, 3 blue, 1 green +Game 56: 2 green, 7 blue; 3 red, 10 blue; 1 green, 2 red; 3 red, 8 blue, 4 green; 1 green, 11 blue, 3 red; 2 green, 8 blue +Game 57: 3 red, 1 green; 1 green, 1 red, 1 blue; 1 red, 4 green, 15 blue; 9 blue, 2 red, 1 green +Game 58: 12 blue, 13 red, 5 green; 2 blue, 6 green; 12 red, 15 green, 7 blue; 5 red, 4 green, 14 blue; 15 red, 2 green, 9 blue +Game 59: 5 green, 5 blue; 4 red, 6 blue, 2 green; 5 blue, 3 green, 6 red; 3 red, 6 green, 4 blue; 3 blue, 7 green, 10 red +Game 60: 1 red, 1 blue, 3 green; 1 red; 3 green, 6 blue; 6 blue +Game 61: 7 green, 1 red, 1 blue; 4 red, 3 green, 1 blue; 7 blue, 7 green; 11 blue, 2 green, 5 red; 5 red, 4 green, 5 blue +Game 62: 17 green, 2 red, 3 blue; 1 red, 3 blue, 2 green; 1 green, 3 blue, 2 red; 1 red, 17 green; 2 red, 15 green, 4 blue; 5 green +Game 63: 2 green, 4 red, 3 blue; 9 blue, 10 red; 1 green, 13 blue, 2 red; 2 green, 1 blue, 5 red +Game 64: 6 red, 8 blue; 3 red, 6 blue, 5 green; 13 red, 11 blue, 8 green; 11 red, 3 blue, 1 green +Game 65: 4 green, 1 blue, 2 red; 3 blue, 3 green, 11 red; 6 green, 3 blue, 3 red; 5 red, 4 blue; 8 red, 5 blue, 2 green +Game 66: 10 green, 13 red; 1 blue, 2 red, 4 green; 7 red, 7 green; 19 green, 9 red, 1 blue; 16 green, 16 red, 2 blue; 10 red, 11 green +Game 67: 3 blue, 4 green, 2 red; 6 blue, 19 red; 4 blue, 2 red, 5 green; 4 green, 5 blue, 1 red +Game 68: 13 blue, 15 red, 7 green; 5 blue, 20 red; 6 green, 12 blue, 8 red; 5 blue, 8 green +Game 69: 13 red, 13 green; 13 green, 3 red, 1 blue; 8 green; 9 green, 9 red +Game 70: 8 blue, 11 red, 2 green; 12 red, 2 blue; 13 red, 6 blue, 3 green; 7 blue, 3 green, 5 red; 15 red, 1 blue, 3 green +Game 71: 7 red, 9 green; 4 blue, 9 green, 7 red; 4 blue, 2 green; 6 blue, 2 red, 9 green +Game 72: 14 blue, 1 green; 4 red, 1 green, 9 blue; 6 blue, 8 red, 2 green +Game 73: 17 green; 10 blue, 2 red, 9 green; 1 green, 10 blue, 2 red; 8 blue, 1 red; 5 blue, 16 green +Game 74: 12 green, 6 red, 5 blue; 2 red, 4 blue, 10 green; 3 green, 4 blue, 2 red; 8 green, 2 red, 5 blue; 5 red, 2 blue, 2 green; 6 green, 1 red, 1 blue +Game 75: 4 blue, 19 green; 15 blue, 7 green; 18 blue, 5 green, 7 red; 16 green, 15 blue; 7 red, 4 green, 13 blue; 9 green, 13 blue +Game 76: 1 red, 2 green, 7 blue; 13 blue, 7 green, 1 red; 13 blue, 5 red +Game 77: 3 red, 10 blue, 6 green; 1 green, 2 red, 10 blue; 7 green, 1 red +Game 78: 11 green, 2 blue; 6 blue, 8 red, 5 green; 10 red, 6 green, 4 blue; 6 blue, 3 green, 10 red; 5 green, 6 red +Game 79: 4 red, 6 blue, 1 green; 1 red; 2 green, 3 blue, 4 red; 4 red, 1 green, 2 blue; 2 green, 1 red +Game 80: 2 red, 1 green; 1 red, 1 green; 7 red, 1 green; 1 blue, 7 red, 3 green +Game 81: 1 blue, 15 red, 4 green; 2 green, 12 red; 4 green, 13 red; 1 blue, 3 green, 13 red; 12 red, 2 green, 1 blue; 3 green, 8 red, 1 blue +Game 82: 18 red, 4 green, 1 blue; 14 red, 1 green, 2 blue; 10 red, 2 blue, 7 green; 13 red; 3 red, 7 green, 1 blue; 5 red, 4 green +Game 83: 4 red, 10 green, 5 blue; 2 red, 12 blue, 13 green; 19 blue, 9 green, 1 red; 2 red, 14 blue, 3 green; 13 green, 8 blue, 5 red +Game 84: 12 blue, 7 red, 9 green; 1 blue, 1 green, 14 red; 1 green, 8 red, 11 blue; 11 blue, 12 red, 3 green; 11 blue, 8 green, 13 red; 7 green, 7 red, 10 blue +Game 85: 10 red, 2 blue; 11 green, 9 red, 4 blue; 3 red, 5 blue, 13 green; 5 red, 5 green; 5 red, 2 blue, 4 green; 11 green, 4 blue, 19 red +Game 86: 1 blue, 6 green, 2 red; 1 red, 1 blue, 8 green; 3 red, 1 blue, 4 green; 1 green, 4 red; 9 green, 2 red; 6 green, 7 red, 1 blue +Game 87: 8 green, 8 blue, 4 red; 5 red, 2 blue, 10 green; 3 red, 13 green; 1 red, 3 blue, 4 green +Game 88: 3 blue, 9 green, 3 red; 2 blue, 15 green; 2 red, 9 green +Game 89: 9 red, 6 green, 15 blue; 10 blue, 7 red, 2 green; 7 green, 16 blue, 4 red +Game 90: 1 red, 1 blue, 7 green; 7 green, 1 blue, 8 red; 3 red, 1 blue, 1 green +Game 91: 1 green, 2 red, 6 blue; 4 green, 4 red, 3 blue; 4 red, 11 green, 4 blue; 3 blue, 5 red; 8 green, 2 red, 8 blue +Game 92: 2 red, 3 blue; 3 blue, 2 green, 2 red; 9 red, 3 green +Game 93: 2 blue, 5 green; 2 green, 5 blue, 3 red; 2 green, 5 blue, 1 red; 7 blue, 4 red, 9 green +Game 94: 1 red, 9 blue, 14 green; 6 green; 2 blue, 11 green; 4 blue, 16 green, 1 red +Game 95: 10 green, 2 blue, 7 red; 4 blue, 4 red, 6 green; 3 red, 2 blue, 3 green +Game 96: 12 red; 3 green, 10 red; 6 blue, 14 red, 2 green; 7 green, 15 red; 3 green, 3 red, 1 blue; 5 blue, 1 red +Game 97: 3 red, 1 green, 1 blue; 1 green, 3 red; 4 red, 1 green +Game 98: 4 red, 5 green, 6 blue; 2 red, 9 green, 6 blue; 2 blue, 11 red, 14 green; 6 green, 4 blue; 11 blue, 11 red, 8 green +Game 99: 2 green, 20 blue; 12 blue; 3 red, 12 blue; 7 blue; 3 green, 10 blue, 2 red; 3 red, 2 green +Game 100: 2 blue, 8 green, 12 red; 2 green, 13 red; 2 red, 4 green; 2 green, 7 red; 10 green, 5 red, 1 blue diff --git a/2023/ocaml/day2/lib/dune b/2023/ocaml/day2/lib/dune new file mode 100644 index 0000000..95a407a --- /dev/null +++ b/2023/ocaml/day2/lib/dune @@ -0,0 +1,2 @@ +(library + (name day2)) diff --git a/2023/ocaml/day2/test/dune b/2023/ocaml/day2/test/dune new file mode 100644 index 0000000..280d827 --- /dev/null +++ b/2023/ocaml/day2/test/dune @@ -0,0 +1,2 @@ +(test + (name test_day2)) diff --git a/2023/ocaml/day2/test/test_day2.ml b/2023/ocaml/day2/test/test_day2.ml new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/2023/ocaml/day2/test/test_day2.ml |