diff --git a/day-15/two.go b/day-15/two.go index 089a447..fed86d9 100644 --- a/day-15/two.go +++ b/day-15/two.go @@ -8,16 +8,6 @@ import ( var boxes = map[int]*orderedmap.OrderedMap[string, int]{} -// add places a lense into an ordered box -func add(id int, label string, focalLength int) { - boxes[id].Set(label, focalLength) -} - -// remove takes a lense out of an ordered box -func remove(id int, label string) { - boxes[id].Delete(strings.TrimRight(label, "-")) -} - // two returns the sum of all lense configurations func two(lines []string) int { hash := newHasher() @@ -38,9 +28,9 @@ func two(lines []string) int { } if strings.Contains(lense, "=") { - add(boxId, label, focalLength) + boxes[boxId].Set(label, focalLength) } else { - remove(boxId, label) + boxes[boxId].Delete(strings.TrimRight(label, "-")) } }