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 2015.
I used Haskell for most of the riddles. Sometimes I conceived a Ruby solution, if there was a neat application for regexes or OOP. For algorithms which profit from random access or are just easily faster imperatively, I used C.
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 | C | Haskell | Ruby | Description |
|---|---|---|---|---|
| 01 | x | x | x | Parenthesis counting |
| 02 | x | Wrapping paper | ||
| 03 | x | Routes delivering to houses | ||
| 04 | ☆ | MD5 mining | ||
| 05 | x | x | Nice string text processing | |
| 06 | x | x | Light installation | |
| 07 | x | Bitwise signal wiring | ||
| 08 | x | x | String escaping | |
| 09 | ☆ | TSP | ||
| 10 | ☆ | Look-and-Say Numbers / RLE | ||
| 11 | ☆ | x | Base26 increment, password rules | |
| 12 | x | JSON number sums | ||
| 13 | x | Seating happiness | ||
| 14 | x | ☆ | Racing Reindeer | |
| 15 | x | x | Optimize cookie receipt | |
| 16 | x | Aunt Detective | ||
| 17 | x | x | Eggnog container subset sums | |
| 18 | x | GoL with Lights | ||
| 19 | x | Medicine with molecules and grammars | ||
| 20 | x | Elves delivering by factor sums | ||
| 21 | x | Bossfight with items | ||
| 22 | x | Bossfight with Wizard and mana | ||
| 23 | x | RAM Computer Simulation | ||
| 24 | x | Optimizing partitions | ||
| 25 | x | Cantor pairing and residue field | ||
| Σ | 6 | 23 | 5 |
In addition to having a lot of fun solving the puzzles, I also applied some interesting programming techniques for the first time in C or Ruby:
- Reading a file letter by letter in C, in Haksell and in Ruby.
- Using Pointer arithmetics, function pointers and calling MD5 in C.
- Some advanced Regex usage in Ruby here and here.
- Creating PNGs with Ruby.
- Doing a neat OOP simulation in Ruby.
- Comparing a naive Haskell solution with a fast C solution using DP.
Also I learned and applied these new concepts about Haskell:
- Parsec, very basicly and in complex situations
->as reader monad- Regexes
- Arrays
- Stacking monad transformers
- Interpreting a very simple programming language
I finally completed all the puzzles:
I enjoy looking at how other coder solved the riddles. This year I followed (A-Z):
