badkins
2021-12-23 23:49:57

Day 23


badkins
2021-12-23 23:50:13

<https://github.com/lojic/LearningRacket/blob/master/advent-of-code–2021/solutions/day23/day23.rkt|Day 23> each part runs in about 1.9 seconds


badkins
2021-12-24 02:06:04

Tried all sorts of optimizations, and the only thing helpful was:

  1. Terminate search if accumulated energy is at least as high as the minimum seen thus far
  2. For amphipods moving from a room, when generating moves, if there are any room-to-room moves, where they move directly home, then don’t bother generating any room-to-hall moves in that case since the room-to-room is optimal. If anyone else came up with a speedup other than those two, I’m super curious. Well, I suppose using a mutable vector for the “board” and a list of mutable amphipod structs is an optimization of sorts.

ben.knoble
2021-12-24 02:26:51

https://github.com/benknoble/advent2021/blob/main/day23/solution.rkt I used mostly sets, though I had to some conversions to lists that probably hurt me. Didn’t do much re: optimizing except your point about room-to-room, and memoizing.