refac day 14 to use new Vec2.bounds function
This commit is contained in:
parent
b90478cd03
commit
b89e9c05ef
14
src/day14.ml
14
src/day14.ml
|
|
@ -44,18 +44,8 @@ let draw_rocks grid points =
|
||||||
|
|
||||||
let parse_grid lines start =
|
let parse_grid lines start =
|
||||||
let points = List.map parse_line lines in
|
let points = List.map parse_line lines in
|
||||||
let lx, hx, ly, hy =
|
let Vec2.{ x = lx; y = ly }, Vec2.{ x = hx; y = hy } =
|
||||||
points
|
points |> List.flatten |> List.append [ start ] |> Vec2.bounds 0
|
||||||
|> 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)
|
|
||||||
in
|
in
|
||||||
let pad_floor = 1 in
|
let pad_floor = 1 in
|
||||||
let pad_x = 2 in
|
let pad_x = 2 in
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user