18
The official awful.systems Advent of Code 2023 thread
(awful.systems)
a community for posting cool tech news you don’t want to sneer at
non-awfulness of tech is not required or else we wouldn’t have any posts
Day 18: Lavaduct Lagoon
[Language: jq]
https://github.com/zogwarg/advent-of-code/blob/main/2023/jq/18-b.jqSatisfyingly short (in lines, not in time writing) some of the longer part is hexadecimal parsing, that doesn't come natively in JQ, I started doing polygon math from part 1, and what took me the longest was properly handling the area contributed by the perimeter. (I toyed with trying very annoying things like computing the outmost vertex at each turn, which is complicated by the fact that you don't initially know which way the digger is turning, and needing previous and next point to disambiguate).
Day 19: Aplenty
[Language: jq]
https://github.com/zogwarg/advent-of-code/blob/main/2023/jq/19-b.jqSatisfyingly very well suited to JQ once you are used to the
stream
,foreach(init; mod; extract)
andrecurse(exp)
[where every output item of exp as a stream is fed back into recurse] operators. It's a different way of coding but has a certain elegance IMO. This was actually quick to implement, along with re-using the treating a range as a primitive approach of the seeds-to-soil day.EDIT: Less-thans and greater-thans replaced by fullwidth version, because lemmy is a hungry little goblin.
19 was a real pain in dart.
Nice!
Also, kudos for working with polygon area from the start. I was too invested in reusing my code as discussed elsewhere, but I came around in the end.