From 4b612ac95d4c186a1cbd551e93616d091e88bf93 Mon Sep 17 00:00:00 2001 From: Dustin Swan Date: Fri, 11 Dec 2020 23:26:07 -0500 Subject: [PATCH] didn't know you could just use = to check equality of 2 nested lists.. --- day11.ml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/day11.ml b/day11.ml index 2a13c9e..fe1da14 100644 --- a/day11.ml +++ b/day11.ml @@ -74,19 +74,10 @@ let change_seats is_far l = ) ) l -let hash = Hashtbl.create 1000 - -let grid_equal g1 g2 = (* abusing hash but not a drug problem *) - match Hashtbl.find_opt hash g2 with - | Some _ -> true - | None -> - let _ = Hashtbl.add hash g2 0 in - false - let rec start is_far grid = (* keep changing seats until the grid stops changing *) (* print_grid grid; *) let grid' = change_seats is_far grid in - if grid_equal grid grid' + if grid = grid' then grid' else start is_far grid'