refac day 14 to use new Vec2.bounds function

This commit is contained in:
ryan 2023-11-08 10:37:44 -08:00
parent b90478cd03
commit b89e9c05ef

View File

@ -44,18 +44,8 @@ let draw_rocks grid points =
let parse_grid lines start =
let points = List.map parse_line lines in
let lx, hx, ly, hy =
points
|> List.flatten
|> List.append [ start ]
|> List.fold_left
(fun (lx, hx, ly, hy) Vec2.{ x; y } ->
let lx = min lx x in
let hx = max hx x in
let ly = min ly y in
let hy = max hy y in
lx, hx, ly, hy)
(Int.max_int, 0, Int.max_int, 0)
let Vec2.{ x = lx; y = ly }, Vec2.{ x = hx; y = hy } =
points |> List.flatten |> List.append [ start ] |> Vec2.bounds 0
in
let pad_floor = 1 in
let pad_x = 2 in