OK, yesterday's part 2 was one of the first times I would personally say I hit a wall where I had to get algorithmically sneaky to get something fast enough. I don't know if that's because I'm using C, so even if my code is garbage, it's fast enough for most things, or because we're in the second half of AoC and $@!# just got real. We'll have to see.
The Puzzle
In today’s puzzle, we are un-done with boats. I thought we were off the boat yesterday, but we're back on the boat today and fiddling with bits to fix the ships docking computer. Also, the memory locations are 36 bits wide because, "Ho ho ho."
The Leaderboards
As always, this is the spot where I’ll plug any leaderboard codes shared from the community.
Ryan's Leaderboard: 224198-25048a19
If you want to generate your own leaderboard and signal boost it a little bit, send it to me either in a DEV message or in a comment on one of these posts and I'll add it to the list above.
Yesterday’s Languages
Updated 10:06AM 12/14/2020 PST.
Language | Count |
---|---|
Rust | 3 |
Ruby | 1 |
C | 1 |
JavaScript | 1 |
Haskell | 1 |
COBOL | 1 |
Python | 1 |
Merry Coding!
Top comments (9)
Part 1 JS solution, Part 2 coming soon. I am angry with myself because I got stuck for 30 minutes on why my code wasn't giving the correct solution when I forgot to reset the bitmask when a new one is declared -_-
Instead of figuring out how to do this purely with bitmasking + bit math, I brute forced utilizing bitvec. Not pretty :)
My Haskell soloution, have to save I've never used bitwise operations in Haskell very much, so had to look all that up. And during that search I realised that foldl', which I defined on day 8, is actually implemented in Data.List, oops.. :-)
Only part 1 for now, it's 5 to midnight and recursion in COBOL is a bit too hard.
Bit twiddling. Rust proves just as adept as C.
My Haskell solution
Github repo available here github.com/cappe987/aoc-2020
Part 1 and 2 in Rust ( github.com/lmammino/rust-advent/bl... ):
We did this in a live coding session available on YouTube:
Rough one today. Don't know if I was tired or what, but I had to resort to Python to get it done in time.
My JavaScript walkthrough: