Skip to content

Commit

Permalink
Naming
Browse files Browse the repository at this point in the history
  • Loading branch information
drewolson committed Dec 26, 2023
1 parent 4ece0a7 commit 1e1b0b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/year2023/day25.ml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ let solve graph =
else (
let n = Random.int le in
let a, b = List.nth_exn edges n in
let node = a ^ b in
let ab = a ^ b in
let edges' =
List.filter_map edges ~f:(function
| e when Edge.equal e (a, b) -> None
| x, y when Node.equal x a || Node.equal x b -> Some (make_edge node y)
| x, y when Node.equal y a || Node.equal y b -> Some (make_edge x node)
| x, y when Node.equal x a || Node.equal x b -> Some (make_edge ab y)
| x, y when Node.equal y a || Node.equal y b -> Some (make_edge x ab)
| e -> Some e)
in
let nodes' = Set.add (Set.remove (Set.remove nodes a) b) node in
let nodes' = Set.add (Set.remove (Set.remove nodes a) b) ab in
aux (nodes', edges'))
in
Util.Sequence.nats |> Sequence.find_map ~f:(fun _ -> aux graph) |> Option.value_exn
Expand Down

0 comments on commit 1e1b0b6

Please sign in to comment.