Technical Articles
Getting ready – Advent of Code 2020
Advent of Code is a yearly virtual event taking place in December. Every day features new programming exercises, which can be solved in your programming language of choice.
Just like Nabheet Madan suggested last year, let’s do this in ABAP!
Advent of Code
ABAP Template
I will be sharing my solutions on GitHub, in preparation I’ve made a template which can be used:
https://github.com/larshp/abap-advent-2020-template
Click “Use this template” to clone all the code to your own repository.
Renaming
To avoid name clashes, there is an option to automagically rename all objects in the repository(including code references), first adjust the rename settings in abaplint.json,
abaplint.json
And run:
npm install && npm run rename
Additional Features
- Editing code via GitHub Codespaces has been configured
- Predefined abaplint configuration
- Github actions setup
As preparation I did a few of the first exercises from last year, see https://github.com/larshp/abap-advent-2019
When the event starts, feel free to share links to your GitHub repositories in the comments below 🙂
Very nice! Thank you!
Would you mind if I do the same but for another project:
https://projecteuler.net/
?
Let’s do task in ABAP.
Moreover for project euler sometimes it is needed to do task ABAP+ C/C++/Python which are on the Linux machine. It is interesting but sometimes is not applicable for production use.
Â
as for renaming: seems really interesting. Thank you!
does that mean that I could upload from gitHub solution with different namespace? Is there vice a versa naming?
Feel free to use it for whatever
Renaming, yea, and vice versa, the rename rules are regex based, but takes care of references to some extend, currently it works somewhat for CLAS and INTF. Just copy the files to your local PC and then run the renaming.
Make sure to keep the template updated, things change
Issues/questions/comments welcome in the template repository here, or in the abapGit slack(invite linked from abapgit readme)
Â
Follow my progress at https://github.com/larshp/abap-advent-2020
Yes, that helped and I think broke something as well... I ran into all kinds of troubles ?
For instance, when I got started on part 2 my output/index.js got its global.abap.initDB() split on two lines, so wouldn't run. Fixed that manually each run.
Also, I never manage to get the READ TABLE working properly reading lines with "KEY table_line = blah"... Same with table assignments. And when trying to bypass that with a local TYPE to get a structure with a named component, the downport put the DATA before the TYPES, so that didn't go well either...
Furthermore, i would expect these two lines to return the same result.
But the first line actually becomes
...which obviously is not the same thing. I guess I should report that to abaplint if it's not already there...
This is so much fun! ?
Yea, its gonna be a challenge 🙂 But traceable since it builds the files in the local folders.
There is an open issue for the associativity, https://github.com/abaplint/transpiler/issues/28
TYPES and DATA, guess thats an error in the quick fix for https://rules.abaplint.org/definitions_top/, can you help opening an issue for it on github?
You beat me to it 🙂