Forum Discussion
Day 12 Is one of those that I’m not sure is possible without scripts in SnapLogic, This problem almost entirely relies on algorithms like A* to complete, and graph traversal and recursive creation of paths is simply not something that is really going to be possible to complete with SnapLogic, sadly. I’ll probably work on parsing the data into a grid and looking at candidate paths via creation in a script snap of some sort and then doing the last processing via SnapLogic, but I’m not sure it will provide all that much value in the end. This is sometimes the problem with programming puzzles, they require some items which SnapLogic IIP can’t really perform with its standard snaps, but we’ll see what kind of things we can work through with these problems.
Day 12 is one that I couldn’t leave alone, and while I don’t consider this “solved” by the stretch of imagination (maybe I’ll convert it eventually) I do consider this a somewhat viable solution for other circumstances, specifically for circumstances when you need an indeterminate loop like this. For this, I figured I’d mess with the script snap and since python is my #2 language, write some python. Below is my screenshot and now attached pipeline (technically, I think I could solve this with a single loop across all coordinates, but maybe I’ll work on that eventually and link it back here). I did the processing to extract the data from the input file still within some mapper, JSON Splitters, Filters, etc. and then passed the data to the script snap to calculate the shortest distance available. The same script was used in both pipelines (by design) and I will be working on likely a better representation of it using pipeline execute calls nested, one to stage the base “data” then the second to process it (we already know processing 10,000 items takes a while with this setup, so I can only imagine this will take a day to process at least).
Screenshot:
SLP File:
day12_2022_12_12.slp (49.5 KB)