Skip to Content
Event Information
Author's profile photo Witalij Rudnicki

#AdventOfCode Challenge 2019. Are you in?

Hello, fellow Developers!

Have you heard about that challenge called Advent of Code:

“Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.” as its author Eric Wastl explains.

While it is nothing SAP-specific, my teammates from SAP Developer Advocates team DJ Adams, Marius Obert, Maximilian Streifeneder, Rich Heilman and people from our SAP community (Nabheet Madan, Christian Drumm, Gregor Brett, Leo van Hengel, Hendrik Neumann to mention those I am aware of) joined it.

Because the requirements are simple: you love to code, you love to have fun, you love to learn. Do you feel like all these are close to your heart? Then join and let us know in comment! Already participating, but not listed above? Please let us know in the comments as well!

You can use whatever programming language or tool you know or you want to learn. Maxi is using Java, Nabheet is using ABAP, Gregor is using Elixir, Rich used HANA SQLScript, while I am using Python and … SAP Data Hub, dev edition.

Why SAP Data Hub?

Because … why not. Yes, it is overkill. But — as I mentioned — the idea is to learn and to have fun.

If you watch that great talk of Eric from two weeks ago (and it is must-watch for many reasons), then you hear about people using Excel, Google Sheets, Minecraft and even paper to solve those puzzles. 🙂

So, here is my solution of the first puzzle from day 2 using Data Hub:

…with the following code for the Python3 operator

def on_input(data_in):
    data= data_in
    intcode_str = data.rstrip().split(',')
    intcode_int = list(map (int, intcode_str))
    result = intcode_int
    cursor = 0
    while result[cursor] != 99:
        result[result[cursor+3]] = result[result[cursor+1]] + result[result[cursor+2]] if result[cursor]==1 else result[result[cursor+1]] * result[result[cursor+2]]
        cursor += 4

    api.send("result", result[0])
api.set_port_callback("input", on_input)

You can import the complete data pipeline code from my GitHub repo:

Let’s start the pipeline.

Open the Terminal’s UI once the pipeline is running. Provide the input from the puzzle, which for me was:


…and get the result 4714701 received from the Python operator and displayed in the Terminal.

Are you in?

Should you be joining that challenge (not necessarily for the sake of leaderboard, but for the sake of knowledge, fun and support) or already joined — let us know in the comment. And do not forget to include links to your code, to your blog posts, or other online resources you created for this year’s Advent of Code, no matter languages or tools you are using!

Happy coding ⌨️
-Vitaliy (aka @Sygyzmundovych)

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo DJ Adams
      DJ Adams

      Nice one Witalij. I just wanted to highlight a couple of things for folks here:

      • if you want to join a friendly chat on this subject amongst like-minded individuals in the SAP dev ecosphere, you can head on over to the #adventofcode channel on the “SAP Mentors and Friends” Slack workspace (if you’re not on there already, you can find an invite link here)
      • This Friday (i.e. TOMORROW, 06 Dec 2019), at the time of writing!) the #HandsOnSAPDev episode will be on this very subject, with two special guests from the community – Hendrik Neumann and Gregor Wolf– showing us some of their ABAP and SAP Cloud Platform functions based solutions to the puzzles ... see for info

      Happy hacking!