Intelecy Blog

Advent of code

Written by Jonathan Camp | Dec 1, 2023 3:04:00 PM

🎄 As the days get colder and the sun abandons Norway, the talk around the office lunch table invariably turns to a debate on language. Not talk of Latin, or Esperanto or Norwegian (though 2024 will surely be the year I start seriously practicing for the Norskprøve), but rather written languages such as Python, Rust or Zig. Everyone shares their opinions and rationale behind their choices, makes bold proclamations about the perceived benefits, and tries to shame others into changing. Making the wrong choice will result in the elves being unable to build presents, the reindeer having insufficient star power, or Santa finding himself stranded on the far edge of the Solar System.

🎁 I am, of course, referring to the annual coding competition: Advent of Code (AoC). Every year, starting on December 1st, thousands of code- enthusiasts try their hands at solving a series of daily Christmas-themed programming puzzles that finish on the 25th. AoC started in 2015 with almost eighty thousand competitors completing the puzzle on day 1. By 2022, that number had grown to two hundred seventy thousand. The puzzles begin simply and increase in difficulty each day, with the final set often requiring extensive knowledge of computer algorithms and mathematics.

🤓 At Intelecy, we have (software) engineers of every sort, and therefore a wide range of language expertise. The AoC competition gives us the opportunity to show off solutions to the same problems, but written with different languages and approaches. Because there are no restrictions on how you solve the problem, you are free to use any approach, even if it isn’t something you would normally use in a professional software setting. This encourages experimentation which is key to growth as an engineer. At the end of the day, we compare solutions, laugh at the ridiculous approaches (I’m looking at you Python eval()), and prepare for the next day.

⭐ We look forward to AoC every year. The puzzles are memorable and the storyline, while usually bonkers, ties it all together. Co-workers who have since left the company, still join in the same team-chat during the competition season, giving us a chance to catch up.

😱 A small selection of crazy (née genius) approaches:

  • Use Python to generate a PNG image of a maze and then use an image editor’s “flood-fill” to find/eliminate solutions

  • Realize that the brute-force approach will take 21 hours, but that it is less time than writing/debugging the elegant approach

  • Write a Python script that generates a sequence of 🐢 Logo commands that draw out the solution

  • Repeatedly eval(...) the puzzle input, silently ignoring exceptions, until it spits out the solution

  • Note that a naïve brute-force approach versus an “optimized” (but still naïve) approach can be the difference between years and hours

If you want to learn more about Advent of Code, or the engineering at Intelecy (I promise, our no-code AI is free from spurious evals()) feel free to find me on LinkedIn or Keybase. And if you want to join the office lunch table and argue for Mojo 🔥, then check out our current openings at https://careers.intelecy.com/.