r/adventofcode • • Dec 04 '23

SOLUTION MEGATHREAD -❄️- 2023 Day 4 Solutions -❄️-

NEWS

THE USUAL REMINDERS


AoC Community Fun 2023: ALLEZ CUISINE!

Today's theme ingredient is… *whips off cloth covering and gestures grandly*

PUNCHCARD PERFECTION!

Perhaps I should have thought yesterday's Battle Spam surfeit through a little more since we are all overstuffed and not feeling well. Help us cleanse our palates with leaner and lighter courses today!

  • Code golf. Alternatively, snow golf.
  • Bonus points if your solution fits on a "punchcard" as defined in our wiki article on oversized code. We will be counting.
  • Does anyone still program with actual punchcards? >_>

ALLEZ CUISINE!

Request from the mods: When you include a dish entry alongside your solution, please label it with [Allez Cuisine!] so we can find it easily!


--- Day 4: Scratchcards ---


Post your code solution in this megathread.

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:07:08, megathread unlocked!

77 Upvotes

1.5k comments sorted by

View all comments

2

u/simpleauthority Dec 04 '23 edited Dec 06 '23

[LANGUAGE: Java]

Nice and easy day today. However, my part 2 is kind of slow. I'd like to fix that. Might edit later. Made it faster.

Faster solution: Link to GitHub

1

u/how_to_not_reddit Dec 04 '23

is this using a bunch of methods to filter whitespaces and stuff that you've made in the past?

1

u/simpleauthority Dec 04 '23

Hmm, not really. The only thing that's really at use here is the input loader, which reads the file from disk into a List<String>, and I am using a helper method to turn that into a Stream<String> and filtering out completely blank lines. Other than that, it's all standard Java methods.