[go: up one dir, main page]

DEV Community

Cover image for Want to have a crack at this Code 100 Puzzle?
Christian Heilmann
Christian Heilmann

Posted on

Want to have a crack at this Code 100 Puzzle?

Code100 is a coding competition by WeAreDevelopers which takes place at various events throughout the next few months with a big finale with lots of prizes next July in Berlin at the WeAreDevelopers World Congress.

Over the next few weeks, we'll release a few puzzles and exercises that allow you to check if you got what it takes to become a challenger in the event. Here is the first one:

The challenge is to take this JSON dataset:

{
    "columns": 80,
    "padChar": "·",
    "events": [
        { "name": "Code 100", "location": "Zagreb, Croatia", "date": "29.11.2023" },
        { "name": "LIVE", "date": "ongoing" },
        { "name": "Coffee With Developers", "location": "various", "date": "ongoing"} ,
        { "name": "World Congress","location": "Berlin, Germany", "date":"17-19.07.2024" }
    ]
}
Enter fullscreen mode Exit fullscreen mode

And convert it into a block of text showing the events.

································································
· Code 100 ············ Zagreb, Croatia ··········· 29.11.2023 ·
· LIVE ··············································· ongoing ·
· Coffee With Developers ·· various ·················· ongoing ·
· World Congress ······ Berlin, Germany ········ 17-19.07.2024 ·
································································
Enter fullscreen mode Exit fullscreen mode

The text should have a border around it using the padChar character and be columns characters wide. The location, if available, should be centered in the block and the name and dates on the left and right respectively. Each data item also needs to be padded with spaces on each side.

You can see the challenge on GitHub and the JSON dataset is available here.

There are already a few solutions in various languages available at this Gist. Looking forward to see more.

Top comments (0)