This is the first time I joined the Advent of Code event. The last time I did some serious programming was in 2002 (with a short non-professional intermezzo in 2012). Also, I decided to use Python, for the sole reason that I want to learn Python and use it next year. On day 8 I was confronted with the fact that people do neurological differ and my neurological peculiarities tripped me up quite badly. But in a fun way, at least now, when I am looking back.

FirstTimer™

Joining is actually not the only first in my AOC2019 adventure:

  • My first time participating in Advent-of-Code.
  • Also first time programming in Python.
  • My second time (in a long time) to take part in a programming contest, last time was https://en.wikipedia.org/wiki/BAPC (see 1994 entry, 25 years ago!)
  • It is a long time after I did some really serious programming (1989 – 2002).
  • First time writing a blog post for Xebia, which has it’s own challenges as I found out.

I joined the Advent of Code because I liked the atmosphere I saw last year in our Slack channel. So, the only reason I joined initially is because some 20 Xebians take part actively, and we have a private leader board for Xebia. I don’t like competitions (I really don’t!). You might therefore think I am a casual player, but I prove to be quite fanatical. I joined late, but I am the fastest riser in the ranking. I get out of bed before 6 AM, and I really try to get a good score by working hard.

The ranking chart on day 8

CasualPlayer™

The chart is thanks to Adé. In case you think I am really taking off in my lilac(ish) fighter jet, just know that I was late to the party and being a ClunkyCoder (TM) means I have to work very hard. I don’t see how I am getting higher than position 10 as long as the Xebians above me play at least as consistently as I do. Yes, I also started making scripts to analyze the ranking over time.

And I have to work hard to get the puzzles done! My programming style shows that I am out of it for a very long time, and only started using Python a week ago.

HardWorker™

In general, my code is very verbose and tedious. For instance, I write out complete loops, instead of using map, join, replace, for/with on strings and lists, and so on. Also, I don’t use regular expressions even though I was very good at using them (20 years ago, could write compilers and evaluators for them), but I don’t have enough time to learn how to use them in Python while doing the puzzle. I use nested array’s instead of numpy, build data structures with recursive function calls, instead of using networkx, and so on.

But I do refactor my code almost every night after I completed the puzzles successfully. Just to see what other solutions have better performance and a (much) more concise code. Also, I can experiment with language features I did not yet know. I collect utility functions in a module I re-use the following day and start the morning by copying a code template into a new code file for the day. Experimenting with language features while trying to solve the puzzle is too much stress for me. So, I might solve some puzzles after the fact with regular expressions!

In summary, I joined because:

  • Adé and Jochem kept on asking me to join, thanks Adé, thanks Jochem!
  • I like the atmosphere in the group on Slack.
  • It forces me to practice a lot, so I can learn to use Python well, which I intend to use next year for other (work related) purposes. This has become my main reason for working hard in AOC2019.
  • This time of the year it is good for my general mood to get out of bed that early, 7 days a week. This is the main reason why I look so fanatical.

OverReactor™

But today both the atmosphere and my mood soured! We had to decode images that consisted of 0’s (black), 1’s (white) and 2’s (transparent). I solved the first puzzle (counting 0’s, 1’s and 2’s) in one go.

The second puzzle consisted of “decoding the image” and the text said, “What message is produced after decoding your image?” I am familiar with ASCII art, and actually learned programming behind an Ampex 230 terminal, so I got the clue: look at the image! My code to construct the final image was working fine (as it transpired much later), but I wondered what I had to post for an answer.

So I took a good long look at the final image:

This looks like nothing to me

Nothing to see there, however much I try to see a Christmas tree (which can’t be right, because every contestant has a different, unique, answer) or some text in a bitmap (much more likely). I didn’t see it.

So I decided to post the final image as a string of 0’s and 1’s as my answer.

Wrong answer!?!?!

Now what?

It took me more than half an hour to debug my code with print statements, finding no faults, and subsequently write a second decoder which gave the same output.

So my output was right, but my answer was wrong.

Then Lulu posted in #codechallenges: ‘oh man… took me a while to find out what “message” it wants me to find in part 2’

So, back to taking a good hard stare at the output ‘image’. Still nothing to see, but now I was convinced that my output was right, so the answer had to be in the image. A simple hack provided me with:

That looks like text to me!

ChaosBrain™

Darn! And then I got so angry (ok, a bit immature when looking back now), because of what a researcher phrased as one of my ‘challenges’ recently: ‘most likely the threshold for signal passing between the synapses in your brain is much lower than for most other people’. For me, for instance, it is very hard to read captchas.

So, I entered my answer (in my case the string ‘PFCAK’), and voilá earned my second star of the day. And I immediately started my refactoring, and replaced the X by a block:

Finally: a clear picture

And this little piece of code is going into my library for re-use. Yes I know: turtle, tkinter, … But I can only learn 674372 ± 42 new things a day…

InsultAfterInjury™

I showed my wife this article. She read ‘PFCAK’ immediately from the first picture with the 0’s and 1’s! Mind you, the quality of that picture is lower than my actual terminal output.

Her remark: I could have saved you an hour this morning…

Now I really feel I suffered from a code ID-10T error

Do you want to know more about this subject?
Look at our consultancy services, training offers and careers below or contact us at info@xebia.com