12-01-2022 12:05 PM
I’ve been a pretty big fan of Advent of Code since I found out about it in 2019 and when I started with SnapLogic in 2021, I figured it could be pretty cool to try to use the SnapLogic IIP to solve all (well, not all, but at least some) of the Advent of Code daily puzzles, mostly to learn better how some of the snaps work, but also get more experience designing pipelines since I’m typically working more in the individual snap development.
This year, I figured I’d post about it here in the community, and to see if others have an interest in attempting to solve the daily puzzles on SnapLogic IIP. I think there are a certain level of these problems that ARE solvable via the IIP, and some that aren’t due to some of them which aren’t.
My ground rules for considering a day solved is:
I figure this might be something that other members of the community might be interested in doing, if you want to participate, feel free to join in on the conversation, I figure we can probably keep discussion to a single thread and do replies per day? Not sure how many might be interested in this, though.
What is Advent of Code?
From the website:
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as interview prep, company training, university coursework, practice problems, a speed contest, or to challenge each other.
You don’t need a computer science background to participate - just a little programming knowledge and some problem solving skills will get you pretty far. Nor do you need a fancy computer; every problem has a solution that completes in at most 15 seconds on ten-year-old hardware.
If you want to join in, go to https://adventofcode.com and connect one of the authentication mechanisms. (I use github, but you can auth with google, twitter, or reddit as well) Logging in for an account is required so that you can receive input specific to you.
If you plan to join and want to join a leaderboard for this project, feel free to join my private leaderboard with the code 1645534-1249c834
.
12-12-2022 04:32 PM
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)
12-13-2022 02:49 PM
Day 13 seems like another “probably can’t do it in SnapLogic” problems. We’d have some hope if there were some sort of value output when it comes to each individual row of the input data and comparing it, etc. We’ll have Day 13 on hold for using SnapLogic IIP (this was almost always a potential known that we’d have some limits with the puzzles). This is one where both parts would effectively be all in the script snap, we could somewhat work around it yesterday by outputting some intermediate values in part 2, but our sort snap doesn’t take an arbitrary comparator, which makes this more difficult.
12-15-2022 08:54 AM
Day14 needed another set of fairly good recursion in order to operate and Day 15 is something I think might be possible, but likely not something I’ll do today, so I’ll post back to see if I’m able to solve it via SnapLogic at some point, there will be some items that are easier than others, part 1 of Day 15 seems maybe a bit more possible than part 2, just based on the loops that I wrote, etc.
12-21-2022 10:07 AM
Okay, it’s been a while since I’ve posted on here, basically every day since Day 12 or 13 has required some sort of while loop shenanigans (typically for a Breadth First or Depth First search). There’s been a few days since then where maybe ONE part is possible, but I might look at doing at least the first part(s) in at least a few of the days. (My java solutions personally have taken longer than they probably should’ve, so I didn’t want to throw too much more time into it)
12-21-2022 10:16 AM
This series is really helpful @ddellsperger, I will go through all over again in the New year.
Missed on the initial days but would be catching up soon.