aboutsummaryrefslogtreecommitdiff
path: root/src/blog
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-12-25 18:52:56 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-12-25 18:52:56 +0100
commit57ef2d54ef65043cc3fcc18b474dad140bfe70aa (patch)
treedbdae2acfa5cccb2bfc12818c38af34eb6843ca6 /src/blog
parent2b30bffc6cfef47c785c9bd3d5aa365750c0d533 (diff)
downloadsebastiano.tronto.net-57ef2d54ef65043cc3fcc18b474dad140bfe70aa.tar.gz
sebastiano.tronto.net-57ef2d54ef65043cc3fcc18b474dad140bfe70aa.zip
Added blog post
Diffstat (limited to 'src/blog')
-rw-r--r--src/blog/2023-12-25-advent-of-code/advent-of-code.md75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/blog/2023-12-25-advent-of-code/advent-of-code.md b/src/blog/2023-12-25-advent-of-code/advent-of-code.md
new file mode 100644
index 0000000..3216486
--- /dev/null
+++ b/src/blog/2023-12-25-advent-of-code/advent-of-code.md
@@ -0,0 +1,75 @@
1# Advent of Code
2
3The [Advent of Code](https://adventofcode.com) is an online programming
4contest that takes place every year in December. It works like an
5[advent calendar](https://en.wikipedia.org/wiki/Advent_calendar), except
6each day instead of a piece of chocolate or a sweet you get a new problem
7to solve.
8
9I have taken part in this contest for the first time this year, after
10an email from a colleague that mentioned prizes for the winner of our
11private leaderboard. Even without any prize, if it is a challenge
12then I must accept it!
13
14*Warning: if you are still trying to complete the problems, you may find
15minor spoilers ahead, but nothing game-breaking.*
16
17## Choosing my weapons
18
19As I was initially not planning on taking part in the challenge, I did
20not have much time to decide which language or tools to use. I opted for
21solving the problems in C, because it is the language I worked with the
22most recently, but in hindsight it would have been more convenient to
23refresh my Python or C++ skills.
24
25In the end using a more limited language did not make a big difference: the
26easy problems were still easy, some of the hard ones became a bit slower
27to type out. I also had some fun implementing some basic data structures,
28for example [heaps](https://en.wikipedia.org/wiki/Heap_(data_structure))
29for [day 17](https://adventofcode.com/2023/day/17).
30
31## The fun
32
33Overall, I really enjoyed solving these problems! I liked the diverse
34set of techniques that were needed: graph algorithms, dynamic programming,
35computational geometry... a very nice selection of brain teasers!
36
37I also liked the fact that the difficulty increased *on average*, but
38sometimes a hard problem was be followed by an easier one. This way,
39even if I found a problem particularly hard, I could still hope that
40the next one would be quicker to solve.
41
42I also liked that other people, including friends, colleagues and my
43girlfriend, were taking on the challenge at the same time. I enjoyed
44explaining my solution or asking my friends to explain theirs. By the
45way, my friend Jared has some in-depth explanation of his solutions
46in his [blog](https://guissmo.com/blog/) - check it out!
47
48## The ugly
49
50There were a couple of problems that I disliked, and all of them for
51the same reason: the problem was not solvable without taking advantage
52of specific properties of the input data that were not made explicit in
53the problem's statement.
54
55As a Mathematician, I am never going to randomly assume that a generic
56graph has a specific structure, or that just throwing the
57[lcm](https://en.wikipedia.org/wiki/Least_common_multiple) into my
58algorithm would make it work. So I was scratching my head for hours trying
59to solve a general problem that was very likely unsolvable, when I only
60had to solve a special case.
61
62However, as a Reddit user pointed out, the input data *is* part of the
63problem statement. Analyzing it to figure out what algorithm may work
64is a skill. I guess I learnt something from this.
65
66## Solutions
67
68If you are interested, you can find all my solutions on
69[my git page](https://git.tronto.net/aoc/) and on
70[Github](https://github.com/sebastianotronto/aoc). They are written in
71[C99](https://en.wikipedia.org/wiki/C99) without any external dependency
72other than the C standard library.
73
74Apart from the harder problems, I have not commented my solutions much,
75but you can send me an email if you want some explanation!

Generated with cgit - Back to sebastiano.tronto.net