:date: 2023-12-11 12:00
Another of the accursed 2d Game Engine puzzles. I couldn't decide if I should just write the game engine or maybe try Numpy. I decided to go with assisted Numpy with ChatGPT giving me syntax. The first part was not too problematic. Basically iterating over all pairs and getting a simple (for Numpy) Manhattan distance.
But the second part required a rewrite of the first (which is always super annoying) and then I just kept having so many annoying little problems. Numpy is great and all, but its syntax and feature set are baroque and difficult to troubleshoot. Finally I had worked it out and Numpy is quite elegant in how it helps once you've pulled it off. However I tried the 1e6 factor and it didn't accept my answer. Turns out that the problem shows an answer for factors of 2, 10, 100 and then asks for 1e6. I had the 2, 10, 100 matching the correct answers, but I forgot to change to the actual input data (not the test data set). Once I realized that my huge number wasn't nearly huge enough and used the correct data, it worked. That took way too long though.