Spoiler Warning: If you want to solve the challenges by yourself, don't read the code.
This directory contains the code I used to solve the challenges from Advent of Code 2016.
The following table lists the available solutions by day and language. I also added a short summary for each day. I marked the solutions which I consider especially valuable or pretty with a star (☆).
| Day | Ruby | Haskell | Description | Letter Language* |
|---|---|---|---|---|
| 01 | x | x | Manhattan turtle walking | AWK |
| 02 | x | Bathroom code pad walking | Brainfuck and Ook! | |
| 03 | x | (Im)possible triangles | CoffeeScript | |
| 04 | x | Room checksums and encryption | C++ | |
| 05 | MD5 door code search | C | ||
| 06 | x | x | Jammed Santa repetition code | D |
| 07 | x | Swedish palindrome IPV7 | Elixir | |
| 08 | x | 2FA display commands | Erlang | |
| 09 | x | Decompress by multiply | Flow.js | |
| 10 | x | Balance Bot Network | Go | |
| 11 | Radiation in elevators | Hack | ||
| 12 | x | x | Leonardo's Monorail machine | Java |
| 13 | x | Cubicles Maze Shortest Path | Kotlin | |
| 14 | x | MD5 Key search | Lisp | |
| 15 | x | Kinetic disc modulus sculpture | Matlab | |
| 16 | x | x | Generate Binary disk checksum | Objective-C |
| 17 | x | MD5 doors in 4x4 rooms vault | Python | |
| 18 | x | Cellular tiled floor | Processing | |
| 19 | x | Elves stealing White Elephants | PHP | |
| 20 | x | IP range block list | Rust | |
| 21 | x | Password scrambling | Scala | |
| 22 | x | 15-puzzle grid computing moves | TypeScipt | |
| 23 | x | Safe cracking machine | Visual Basic | |
| 24 | x | Duct round trips | Wolfram Language | |
| 25 | x | Clock signal in assembunny | Zsh | |
| Σ | 23 | 4 | * coming soon |
In addition to having a lot of fun solving the puzzles, I also learned some interesting programming techniques:
- Writing programs in a language named Brainfuck
- Creating a debugger/IDE thingy using flow and React for Brainfuck with CI testing
- Pointer and value semantics in C structs
- Making a script runnable via
rspecorruby - Global methods in Ruby
- Speed and languages: Day 12 has fast (3s) Haskell solution, which is slow through
runhaskell(350s), a long and fast (<1s) Java solution and a Ruby solution in between (15s). However, building a C program with AWK and compiling builds the solution instantly. - Optimizing a Ruby script: MD5ing in day 14 runs 80s, with fork parallelism 40s, with critical paths in C 13s, with both 5s.
- Optimizing a Crystal program: MD5ing in day 14 runs 40s, with OpenSSL's md5 20s (using ugly Pointers does not help), with fork parallelism 8s, but compiling takes an additional 11s.
- Optimizing a Scala program: MD5ing in day 14 ran 740s with a md5 found on StackOverflow, with a better formatter 166s and 46s with a specialized formatter.
- Ruby 2.4.0 was released at the end of AoC: The new hash improvements were not noticeable in Day 14's script. But the new
Array#summethod (see 0424ecbb2d37b68f007bb1e44005de79ed7c9ef3) and the newRegex#match?were already useful.
This year I sometimes tried to get on the daily leaderboard. And indeed I managed to get there on 4 days 1, 6, 8 and 11 scoring a total of 184 points. If the overall leaderboard was longer I'd have position 272 of about 1300 people who completed the puzzle or 13k who started it.
I enjoy looking at how other coder solved the riddles. This year I followed (A-Z):
- bildzeitung (Python)
- cschell (Elixir)
- fdlk (Scala)
- glguy (Haskell)
- msullivan (Haskell, Python)
- Pyrobolser (C#)