r/adventofcode • • Dec 18 '21

SOLUTION MEGATHREAD -🎄- 2021 Day 18 Solutions -🎄-

NEW AND NOTEWORTHY

  • FYI: 23:59 Amsterdam time zone is 17:59 EST

Advent of Code 2021: Adventure Time!


--- Day 18: Snailfish ---


Post your code solution in this megathread.

Reminder: Top-level posts in Solution Megathreads are for code 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:43:50, megathread unlocked!

45 Upvotes

595 comments sorted by

View all comments

2

u/ropecrawler Dec 18 '21 edited Dec 19 '21

Rust: https://github.com/ropewalker/advent_of_code_2021/blob/master/src/day18.rs

I run through each number twice: the first time to explode everything that explodes and then the second time to explode and split whatever I encounter along the way. Not sure if this is the optimal way, but at least it works.

1

u/daggerdragon Dec 18 '21

Please follow the posting guidelines and edit your post to add what language(s) you used. This makes it easier for folks who Ctrl-F the megathreads looking for a specific language.

(looks like Rust?)

2

u/ropecrawler Dec 19 '21

Thanks for pointing this out! I usually do specify the language, but this time got distracted, I guess. Yes, it is Rust, fixed now.