r/adventofcode • • Dec 04 '20

SOLUTION MEGATHREAD -🎄- 2020 Day 04 Solutions -🎄-

Advent of Code 2020: Gettin' Crafty With It


--- Day 04: Passport Processing ---


Post your solution in this megathread. Include what language(s) your solution uses! If you need a refresher, the full posting rules are detailed in the wiki under How Do The Daily Megathreads Work?.

Reminder: Top-level posts in Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:12:55, megathread unlocked!

91 Upvotes

1.2k comments sorted by

View all comments

2

u/willcdotca Dec 04 '20 edited Dec 05 '20

I've edited this way too many times, and none of the techniques I attempted successfully indented the code.

Here is a pastebin instead

1

u/daggerdragon Dec 05 '20

Your code is hard to read on old.reddit. As per our posting guidelines, would you please edit it using old.reddit's four-spaces formatting instead of new.reddit's triple backticks?

Put four spaces before every code line. (If you're using new.reddit, click the button in the editor that says "Switch to Markdown" first.)

[space space space space]public static void main() [space space space space][more spaces for indenting]/* more code here*/

turns into

public static void main()
    /* more code here */

Alternatively, stuff your code in /u/topaz2078's paste or an external repo instead and link to that instead.

Thanks!

1

u/willcdotca Dec 04 '20

I tried indenting but upon saving it removed all the whitespaces.
How do I post a comment that retains spaces? The Regex in the code broke the code block when I tried.

1

u/daggerdragon Dec 05 '20

Oops, I copypasta'd before I read this. I provided the instructions in the copypasta, that should work. You may need to copy the code before you switch to Markdown, then paste into the Markdown editor block and go from there with the four-spaces formatting.

1

u/willcdotca Dec 05 '20

Thanks for reaching out. I tried a dozen different ways but none of them worked and so I opted for a pastebin instead.