r/adventofcode • u/daggerdragon • Dec 04 '18
SOLUTION MEGATHREAD -π- 2018 Day 4 Solutions -π-
--- Day 4: Repose Record ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).
Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
Advent of Code: The Party Game!
Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!
Card prompt: Day 4
Transcript:
Todayβs puzzle would have been a lot easier if my language supported ___.
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked!
38
Upvotes
View all comments
Show parent comment
1
u/CatpainCalamari Dec 05 '18
I found parsing the log format the simplest part of the task, but that is because I got completely stuck on the minutes-part... I was experimenting with LocalDateTime and hour-wraps to get the minute portions, until I finally looked at your solution (because I grew frustrated) and notices you don't handle the hour-wraps. Then I carefully reread the puzzle description and felt like an idiot.
Anyway, I parsed the log using Scala Regex-Parsers and got good results with it:
I use it like this: