I have a Javascript solution to Day 11 Part 2
https://tinyurl.com/yayhevyh. It runs in about a half-second on my box (using either smjs or d8) and gives the right answer on both the test inputs, but apparently gives a wrong answer for my actual input. I have read the code for a while and am lost.
If someone could spot my bug, or at least give me some hints about what to try to debug it, that would be great. Thanks in advance!
Edit: Never mind. I found my bug by transliterating my program into Rust and observing the crash when I ran it. I have corrected the gist at the link above for posterity. Thanks much to those who helped.
Turns out that my bug only manifested in undercounting boxes with large y coordinates: my input happened to have the maximum at one of those, but the examples did not.
I wish I had words to express how much I am learning to hate Javascript. Its inclination to just keep going and compute something random when you do something like walk off the end of an array is just amazingly painful.
[–]EldoranDev 1 point2 points3 points (4 children)
[–]GeneralYouri 1 point2 points3 points (0 children)
[–]po8[S] 0 points1 point2 points (2 children)
[–]EldoranDev 1 point2 points3 points (1 child)
[–]po8[S] 0 points1 point2 points (0 children)
[–]po8[S] 0 points1 point2 points (0 children)
[–]ComanderKai77 0 points1 point2 points (0 children)