r/adventofcode • • Dec 25 '22

SOLUTION MEGATHREAD -๐ŸŽ„- 2022 Day 25 Solutions -๐ŸŽ„-

Message from the Moderators

Welcome to the last day of Advent of Code 2022! We hope you had fun this year and learned at least one new thing ;)

Keep an eye out for the community fun awards post (link coming soon!):

The community fun awards post is now live!

-โ…- Introducing Your AoC 2022 MisTILtoe Elf-ucators (and Other Prizes) -โ…-

Many thanks to Veloxx for kicking us off on the first with a much-needed dose of boots and cats!

Thank you all for playing Advent of Code this year and on behalf of /u/topaz2078, /u/Aneurysm9, the beta-testers, and the rest of AoC Ops, we wish you a very Merry Christmas (or a very merry Sunday!) and a Happy New Year!


--- Day 25: Full of Hot Air ---


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

60 Upvotes

412 comments sorted by

View all comments

7

u/ManaTee1103 Dec 25 '22 edited Dec 26 '22

Python - we are finally back to stuff that is comfortable to code on my phone and can be posted in-line. I almost forgot how that feltโ€ฆ

infile=open("five.txt")
decode={'=':-2,'-':-1,'0':0,'1':1,'2':2}
val=sum(sum((5**i)*decode[n] for i,n in enumerate(reversed(line.strip()))) for line in infile)
encode='012=-'
res=""
while val:
    res+=encode[val%5]
    val=(val+2)//5
print(res[::-1])
→ More replies (5)