The Art of Programming– The Advent of Code Programming Puzzle Marathon image

The Art of Programming– The Advent of Code Programming Puzzle Marathon

Just over three weeks ago, a colleague told me about The Advent of Code 2023. She explained how for 8 years every year in days and weeks leading up to Christmas every day a puzzle is released. A puzzle that you probably can only solve by making use of programming. How you implement your solution, using which language, tools, algorithms and other tricks is up to you. You submit the answer – usually a large number – and learn if it is correct. If it is, you get awarded a silver start and you receive a second assignment – typically somewhat harder than the first one. Solve that one, and a correct answer earns you a gold star. For 25 consecutive days, stars can be won.

I liked this idea and also my colleague’s suggestion that we organize a competition within our Conclusion ecosystem – of 30+ companies and close to 2800 colleagues. Not all of them programmers, but still a good number of potential participants. I decided on a few prizes for the top-performers ( and a cake bonanza for the winning team) and invited colleagues to join in. The lead time was very short (two days). Still, over 70 colleagues signed up and started earning stars over the next few days. We set up a Teams environment for sharing frustrations and epiphanies and the odd tip (and admiration).

The initial puzzles were somewhat challenging but certainly doable. Since the time of submission plays a role in awarding points and I am an early riser, for the first few days I was in the top 5 of our organization’s leaderboard. Was I going to win a prize I had awarded myself? That did not feel quite right.image

I need not have worried:after a week or so, the complexity of the puzzles started to increase. I lost momentum. A number of colleagues emerged as the toughest, disciplined competitors and the most versatile programmers. We ran into each other in the office and discussed today’s challenge. And earlier, mind boggling, brain cracking assignments.

I was and am impressed by how programming seemed to take off to the next level. In our regular work, sure we have to program. We develop solutions that satisfy functional requirements and of course fit within the non-functional boundaries. But the challenge is usually more in understanding the user’s wishes and the functional objectives than in cracking very complex programming nuts. But these puzzles in their misleading simplicity, devoid of the regular web of dependencies and limitations, brought out the real programming skills. Colleagues started applying patterns and algorithms that were needed, not just for finding an elegant solution but also a solution that would be produced within a few seconds. The naive, brute force method in many cases only produced an answer after hours of processing – or not at all. Shoelace algorithm, priority queue, Dijkstra’s algorithm, Bellman Ford, Kadane. A largely new world of simple, elegant, brilliant approaches to deceptively simple challenges was unveiled. It is almost like walking into a  museum and seeing a series of master paintings for the first time. Wow, that such a thing exists.

Programming at this level is craft or even an art that I do not (yet) master. I am in awe of my colleagues who do. Last night, we gathered with a dozen competitors to discuss our solutions to some of the earlier puzzles. What approach was selected – and how was it then applied? What caused the breakthrough – untied the knot? What were corner cases that needed to be dealt with. What programming language and tool was used? What does the actual code look like? And in some cases, nice anecdotes were shared, frequently dating back to university, homework assignments and exams. Occasionally to work situations where a similar challenge needed to be addressed.

In general, there seem to be three stages

1. Analyze Requirement: Read, analyze the puzzle. What is the objective [of the puzzle] , what is desired of us. What are constraints, what do we need to take into account?

2. Devise the approach, pick and shape the algorithm, visually and in pseudocode, using patterns

3,. Implement the code – pick a programming language (we have seen at least these languages and tools: Excel, Bash, Java, Python, C++, TypeScript, JavaScript/Node, C#, Rust, Google Sheets, Mendix), write the code, test it, and run it for real

Then submit the solution, get the feedback and perhaps return to the drawing board. Did we misunderstand the assignment? Miss an edge case? Mess up the input?

We will know the winners of The Advent of Code 2023 Conclusion Leaderboard at midnight on New Year’s Eve. I already know that I have several colleagues who are not merely good software engineers and valued application developers but who are really very good programmers – artists in their own right. Who revel in tough challenges and finding smart solutions by combining well known patterns and algorithms that fit the problem and implementing them in elegant, well performing code.

image

I am hoping to organize our own Conclusion Code Competition in the Spring of 2023 – where teams from the Conclusion companies compete as well as individual colleagues, customer teams and teams from  various universities. Sure, for prizes, But primarily for fun and the discovery of this wonderful art of pure programming.

Resources

25 algorithms every programmer should know – https://medium.com/techie-delight/top-25-algorithms-every-programmer-should-know-373246b4881b

10 algorithms we should know – https://dev.to/codesphere/10-algorithms-every-developer-should-learn-3lnm

Find majority element – elegant! – https://www.techiedelight.com/find-majority-element-in-an-array-boyer-moore-majority-vote-algorithm/

Processing – https://processing.org/ – a flexible software sketchbook and a language for learning how to code and to teach programming fundamentals within a visual context, Processing has also evolved into a development tool for professionals.. (used by one colleague, to also visualize some aspects of the puzzles)


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.