never touching day 15 ever again

This commit is contained in:
ryan 2023-11-21 16:50:51 -08:00
parent 894e83fe12
commit 8270ee7aa8

View File

@ -112,7 +112,7 @@ let solve_part_1 lines scan_y =
let region =
if x + 1 < next && (could_be_beacon sensors false @@ Vec2.of_tuple (x + 1, scan_y))
then 0
else next - x - 1
else next - (x + 1)
in
count_not_beacons (count + intersection + region) (next :: rest)
| _ -> count
@ -121,14 +121,12 @@ let solve_part_1 lines scan_y =
;;
let%expect_test "Day 15.1 example" =
let possible_beacons = solve_part_1 example_lines 10 in
Printf.printf "%i\n" @@ possible_beacons;
Printf.printf "%i\n" @@ solve_part_1 example_lines 10;
[%expect {| 26 |}]
;;
let%expect_test "Day 15.1" =
let possible_beacons = solve_part_1 (Utils.lines_of_input 15) 2000000 in
Printf.printf "%i\n" @@ possible_beacons;
Printf.printf "%i\n" @@ solve_part_1 (Utils.lines_of_input 15) 2000000;
[%expect {| 5525990 |}]
;;