Advent of Code 2019

2020/01/01

For the first time I’ve participated in “Advent of Code” contest. It promised to be a fun time and a good opportunity to learn a new programming language. I’ve taken Clojure from my bucket list and dived head first into the contest.

The first few tasks are deliberately very easy, so that participants firstly would get into the mood and would not detract by the bar raised too high, and secondly to let one to get acquainted with the platform and rules, set up the coding environment and get hands-on with the new language (if you one uses such).

The problems were of varying complexity and some of them required prior knowledge of algorithms. The hardest one were about searching a path in a maze. The cool twist was the addition of the IntCode virtual machine. Over the course of a few days the problems were shaping the definition of the IndCode VM. Participants were expected to implement and to debug it in order to solve the problem.

Clojure has shown strong and I’ve rarely struggled with the language. Debugging tools could be better though. All the solutions could be found here on Github.

For an additional fun I’ve produced animations for some of the problems. For that I’ve used awesome Quil library which implements Processing.org API.

Problem 13 - Care Package

Arkanoid AI should be implemented in IntCode. Each block in the game has its own unique value and the answer of the problem is the end score.

Problem 15 - Oxygen System

A robot have been deployed to a maze of unknown structure. By issuing movement and observation commands the maze should be fully explored and a marked cell should be found. Then the time to fill the maze with air should be calculated, given that the air is injected in the bottome left corner and it spreads each tick to the adjacent cells.