DEV Community

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

Posted on

2

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.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay