My entries for AdventOfCode.com, written in PureScript.
Disclaimer: I'm not claiming that this code is beautiful, or even 100% correct, just that it earns me those precious, precious stars. :-D
npm install -g yarn
yarn
yarn run bower install
yarn run pulp test
That was fun. Since it was the last one, I drew it out a bit by writing a full parser instead of just Vimming the instruction list into data. I made the infinite tape out of just a set of the addresses that are 1s.
Forced me to think about bidirectional graph representation, which is interesting. There's probably a better go-to data structure that I must hunt out.
Another really interesting one - reverse-engineering machine code. I've never done anything like that before. It was very satisfying when the penny dropped about what the program actually does.
Performance problems at first, but basically it's just Langton's Ant, which I've done before.
Ugh! Did it, but this is my personal shame list. :-(
Part 1 was trivial. Part 2 took ages, but because I insisted on going with maths rather than simulation, and I got one of the intermediate formulea wrong, which took ages to find. I'm please I can still solve a quadratic equation though!
Much easier than it looked at first!
Probably the most interesting challenge yet. I've solved it, but hopefully I'll find time to circle back and actually do something elegant. :-}
Phew! Editor problems and life getting in the way. Nearly didn't finish this one. Good puzzle though.
Another fun one. I made a wrong assumption about how I could optimise step 2, and that slowed me down, but ended up with a nice optimisation that made the whole thing performant enough. :-)
Had to deal with integer overflow (!), but easy enough if you'll forgive the fact that eachs solution takes 60s to run.
Much easier than it initially looked, thanks to Day 12.
Bit disappointed I could get this performant with lazy sequences, but the sieving trick works nicely.
Enjoyable. I reckon I could write a simple parser blindfolded now. This is great practice.
Fun. I've never looked into hexagonal coordinate systems before. :-)
This one was a bit of a slog. I'm going to start fearing the Sundays. The spec could have been clearer. Lord alone knows how people managed to solve this in less than 10 minutes. :-o
Fun. My parser practice is paying off. I would not like to do this challenge without a combinator-style parser library!
Also, that's probably the easiest conversion-to-round-2 so far.
Probably my most elegant solution yet, just through using Control.Fold. Also - wow - a real, decent-sized parser. :-)
Nice. Makes me want to sit down with a bowl of satsumas and catamorphism tutorial.
This seemed like an easy one that just had a lot of legwork.
I have clearly gotten over my phobia of Data.Tuple.Nested, as I'm
using /\
syntax everywhere now. :-)
Not hard, but hard to get performant. Part 2 really falls apart if your implementation isn't quick enough.
Easy. I'm willfully over-using Fold
here for the fun of it.
The hardest so far. I got the algorithm really quickly, but getting it right took me ages. I'm very gad this challenge happened on a weekend.
Used a real parser today! Nice excuse to use Control.Fold too. I wish I'd figured out how to solve this one in O(n) time. :-/
Fun. An easy start. I wish the spec had been clearer though.
I need to get familiar with PureScript parsing libraries. Arguably using a real parser is overkill for the task, but why am I doing this if not to learn? :-D