What is the speed solution to Year 25 "My First Shredding Memory"?
I have the following solution to the puzzle, which solves the size challenge, but for time I need to shave off 7+ seconds (target = 132, my best = 139), and I don't understand how... 🤔
Basically, I think the problem is that the humans aren't getting out of the way at the end (when there's no more datacubes to pick up, so the other ones need to wait for them to shred themselves... And I can't see a way to move them out of the way or anything since I don't have the step
command or things like that 😕
-- 7 Billion Humans (2145) --
-- 25: My First Shredding Memory --
mem1 = nearest shredder
a:
mem2 = nearest datacube
pickup mem2
giveto mem1
jump a
Has anyone been able to solve this with average time below 132s?
Apparently, when a program ends, they start moving out of the way, so just had to add an end
somehow:
-- 7 Billion Humans (2145) --
-- 25: My First Shredding Memory --
mem1 = nearest shredder
a:
mem2 = nearest datacube
pickup mem2
if myitem == datacube:
giveto mem1
else:
end
endif
jump a
You are right that the traffic in front of the shredder when there are no more cubes to pick up is the problem. The solution is that after you pickup mem1
, you should check to see if they actually picked something up. If they didn't, then you can end
their program.
This way, they stop near the point of the failed pickup and not near the shredder and are out of the way.
pickup mem1
if [my item] == [nothing]
End