6
votes
Day 13: Claw Contraption
Today's problem description: https://adventofcode.com/2024/day/13
Please post your solutions in your own top-level comment. Here's a template you can copy-paste into your comment to format it nicely, with the code collapsed by default inside an expandable section with syntax highlighting (you can replace python
with any of the "short names" listed in this page of supported languages):
<details>
<summary>Part 1</summary>
```python
Your code here.
```
</details>
Probably one of the easier days so far for most of the logic. I guess if you haven't dealt with math in a bit this could be tricky, but compared to some previous AoC math-y problems this was fairly tame.
I spent most of my time trying to get regex working properly.
Smalltalk Solution
Do you think your Smalltalk ability is improving as you solve more puzzles? I came close to taking Inria's Pharo course but had to drop it before even starting due to a crisis. I see there's an advanced course with Pharo now too.
I did download the first week's material during a re-run but again had to drop it due to "circumstances". During that first week though, I was amazed at being able to search, inspect, poke around and change literally everything about the language and environment including the IDE. Reminded me so much of why I fell in love with emacs.
You're absolutely right that the tools to edit the environment and built-ins is probably the coolest part. Numerous times now I've found myself thinking "oh man, I wish that X had a Y feature..." before realizing, I can just add that! That and the tests/debugging definitely set it apart from other languages in how you work.
I've definitely been learning a lot as I go! Most days I'm kicking myself as I find a tool that would have been very helpful on a previous problem. I looked at those MOOC courses myself, and started through the first couple weeks of one, but ended up finding this book more useful: Pharo By Example.
The only pain point so far is that finding/guessing method names and what they do has not been very intuitive. The aim of having the names flow more like natural language is neat, but ends up making it tough to get used to, coming from other languages.
It's probably a bit like cutting a loaf of bread with a chainsaw, but z3 makes this problem trivial.
Part 1+2
Woke up early today by chance.
Parsing
Solution
Discussion
That PhD in Math do be paying off lmao.Solution works for both parts (just add that ridiculously large number at the appropriate place).
I'm not the strongest with math, but I got there in the end. The actual programming part for this wasn't especially difficult, though I got tripped up with floating-point precision for a little bit.
Solution (Jai)