I realized having to host this potentially indefinitely might not be the best idea, so I am going to shut down this gitea instance eventually.
You’ll have time, at least until the end of 2022, probably longer, but please just get all your stuff somewhere safe in case we ever disappear.
HTML files of the blog posts at https://kageru.moe/blog/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
6.9 KiB

<a href="/blog">
{% load static %}
<div class="bottom_right_div"><img src="{% static '2hu.png' %}"></div>
<div class="wrapper_article">
<p class="heading" style="line-height: 1.1em">Challenges for the Advent of Code or<br>“How to Bite Off More Than You Can Chew, but not too much”</p>
<div class="content">
<p class="subhead"><a href="#c_introduction" id="c_introduction">Introduction</a></p>
Humans love challenges.<br>
We want to prove something to our friends, our coworkers, our peers, or even just ourselves.<br>
We want to push ourselves to our limits, maybe even beyond them, and grow into more than what we are.<br>
We want to show the world that we can do something, whatever that may be.<br>
We want to get just a tiny bit closer to the optimal version, to the person we could become.<br>
That’s one reason to do Advent of Code. The other — and much more common — is probably just boredom.<br>
For those unaware: Advent of Code is like an advent calendar where there’s a coding task hidden behind each door. You receive a randomized input (actually a randomly selected one from a precomputed set because they can’t store and solve a new puzzle for every user), and you have to enter your solution on the website. How you get that solution doesn’t matter. That should give you a basic idea. Onto the actual content of this.
<p class="subhead"><a href="#c_leaning" id="c_leaning">Learning From Past Experiences</a></p>
Last year, I failed the Advent of Code. And not just a little bit. I really mean I failed.
I wanted to use it as an opportunity to learn Haskell, so my plan was to implement all 24 tasks in Haskell.
This should, in theory, give me enough practice to understand the basics and become at least reasonably comfortable in the language.
Reality was… not quite that.<br>
Not only did I not finish even <em>a single</em> puzzle in Haskell, but it deterred me from even trying to learn any functional language for quite a while (that is, until today and ongoing).
I then switched to Nim because reasons, but I didn’t finish all 24 in that either. I ended up skipping ~70% of all days.
What do we learn from that?<br>
Well, for one, we shouldn’t just plan tasks of completely unknown complexity. “It will be alright” is not how you approach software. I’ve done that, and it works more often than it should, but this is really a case where it was just silly.
For two, (I know that’s not how english works; don’t @ me) I needed variety. Just picking one language may work for other people and it’s certainly useful if you want to learn that language, but it wasn’t enough to keep me motivated.
<p class="subhead"><a href="#c_forward" id="c_forward">Going Forward</a></p>
So what did I change this year? Simple.
<li title="yes, I still can’t into functional programming">I will not use programming paradigms that are completely alien to me</li>
<li>I will use more than just one language to keep things interesting</li>
<li>I will brag as openly as possible about my plans so people can publicly shame me for not following them</li>
I know that there are people who try “24 days, 24 languages”, but I’m not quite that insane. For me, 8 languages should be enough. I’m giving myself three tickets for each language. It is up to me which language I will use for any given day, as long as I have at least one ticket left for that language.<br>
I’ve created a git repo for this challenge <a href="https://git.kageru.moe/kageru/advent-of-code-2018">here</a>.<br>
The number of remaining tickets for each language can be tracked in the <code>tickets.md</code> file.<br>
Edit: looks like there are 25 Days, and I misjudged a few things, so I had to change my plans here on day one. Still keeping this section, just because.<br>
The languages I have chosen are (in alphabetical order):
That puts us at 6 compiled and 2 interpreted languages. Out of these, I would rate myself the most proficient in Python and the least proficient in C. Contrary to popular belief, you can be a software developer <span title="Just for the sake of the stupid pun, I just opened a terminal and ran “touch c”. Kill me pls.">without ever having touched C</span>.<br>
<br>I would like to add that I’m not necessarily a fan of all of these, especially Java. However, since I’m currently working on a ~1,000,000 loc Java project as my fulltime job, not including it here just felt wrong.<br>
To show my remorse and to give me a very early impression of the suffering that this decision will bring with it, I’m typing this paragraph in <a href="https://www.gnu.org/fun/jokes/ed.msg.html">ed, the default editor</a>.
It really is quite the experience. The creativity of the people who wrote it is admirable. You wouldn’t believe how many convenience features you can add to an editor that only displays one line at a time. (Let me also remind you that ed was used before monitors were a thing, so printing lines wasn’t free either.)
This is, unironically, a better editor than most modern default editors (referring mostly to Windows Notepad and whatever OS X uses).<br>
Oh, and ed supports regex. Everything is better if it supports regex. But I digress.
Apart from the JVM languages, I’ll write all of the solutions in vim, using only Syntastic and the language’s respective command line compilers.
Java is just too verbose to be used without introspection and autocompletion. At least for my taste.
vim can be really cool to use, and I love it for most languages, but Java is just not one of them. Still typing this in ed, btw. :^)
If I come across a solution that seems particularly interesting to me, I might share it here, but I doubt that will happen.
Let’s see how far I can get this year. Expect a recap of this year’s inevitable failure here around the end of the year.
Edit: after finding out that JS has basically no consistent way of reading files, I removed that from the list. It’s garbage anyway, and I’m not writing node.js. Since all of this doesn’t really work with 25 days either, I’ve also decided to drop two more languages to get me to 5x5.<br>
That left me with C, Go, Kotlin, Python, and Rust. 5 days each.
<span class="ninjatext">I thought about including Haskell in this list, but I decided not to repeat history… at least for now</span>