Preparing for Advent of Code 2023
2023-11-28 02:46:50 Author: blogs.sap.com(查看原文) 阅读量:10 收藏

This year, I once again intend to join the fun of solving programming puzzles in the Advent of Code event, using ABAP.

                                           |
                                          \|/
                                         --*--
                                          >o<
                                         >O<<<
                                        >>o>>*<
                                       >o<<<o<<<
                                      >>@>*<<O<<<
                                     >o>>@>>>o>o<<
                                    >*>>*<o<@<o<<<<
                                   >o>o<<<O<*>>*>>O<
                                      _ __| |__ _

Since 2015, the Advent of Code has been an annual advent calendar consisting of programming puzzles and challenges and runs from December 1st to 25th each year. While some puzzles may be more challenging than others, anyone with basic programming knowledge and some problem-solving skills can participate. It’s great fun and a way to get a short break from reality!

In 2020, I solved the puzzles in ABAP, albeit the hard way, using VSCode and transpiling ABAP into JavaScript. This year, things will be easier as I plan to use just the ‘ABAP Developer Edition 1909 docker’.

abap2UI5

To assist me in keeping track of the inputs, results and overall progress, I decided to give abap2UI5 a go and made myself a frontend app:

UI5%20frontend%20for%20the%20advent%20calendar%20and%20solution

UI5 frontend for the advent calendar and solution

abap2UI5 offers an interesting approach to UI5, and a super easy install using abapGit. Having a background in UI5 development is a great help when getting started, to have an understanding of the different controls and their parameters. I haven’t spent too much time on abap2UI5 yet, but I’ve experimented with some different controls, data bindings, and communications with the SAP backend. And especially for simple stuff like this, it’s great! Good stuff! Well done!

Join the Fun!

Anyway, I encourage you to participate in the fun. If you decide to, feel free to use my preparations found in my abap-advent-2023-template repo on GitHub. It includes:

  • Pre-prepared “empty” solution classes for each day, including:
    • A method for each expected part
    • An inherited generic ‘solve’ method that splits the input string into a table, calls each part’s solution method, and measures runtime (just for fun)
    • A local test class with test methods for each part
  • A UI5 frontend built in ABAP using abap2UI5, featuring:
    • A randomized tile layout for the days, like the paper advent calendars of old 🙂
    • A puzzle input area
    • Backend solution execution
    • Completion toggling
    • Storage of input data and completion flag
    • (Note: I designed this for single-user use, but expanding it should be relatively straightforward if needed)
    • (And you’ll need to install abap2UI5 to use the frontend)

Sharing Solutions

If you’re planning to share your solutions, I’d love to see them! You can find mine at https://github.com/joltdx/abap-advent-2023 when we get going!

Have fun!


文章来源: https://blogs.sap.com/2023/11/27/preparing-for-advent-of-code-2023/
如有侵权请联系:admin#unsafe.sh