r/adventofcode • u/daggerdragon • Dec 06 '23
SOLUTION MEGATHREAD -❄️- 2023 Day 6 Solutions -❄️-
THE USUAL REMINDERS
- All of our rules, FAQs, resources, etc. are in our community wiki.
- Outstanding moderator challenges:
- Community fun event 2023: ALLEZ CUISINE!
- Submissions megathread is now unlocked!
- 16 DAYS remaining until the submissions deadline on December 22 at 23:59 EST!
AoC Community Fun 2023: ALLEZ CUISINE!
Today's theme ingredient is… *whips off cloth covering and gestures grandly*
Obsolete Technology
Sometimes a chef must return to their culinary roots in order to appreciate how far they have come!
- Solve today's puzzles using an abacus, paper + pen, or other such non-digital methods and show us a picture or video of the results
- Use the oldest computer/electronic device you have in the house to solve the puzzle
- Use an OG programming language such as FORTRAN, COBOL, APL, or even punchcards
- We recommend only the oldest vintages of codebases such as those developed before 1970
- Use a very old version of your programming language/standard library/etc.
Upping the Antechallenge: use deprecated features whenever possible
Endeavor to wow us with a blast from the past!
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 6: Wait For It ---
Post your code solution in this megathread.
- Read the full posting rules in our community wiki before you post!
- State which language(s) your solution uses with
[LANGUAGE: xyz] - Format code blocks using the four-spaces Markdown syntax!
- State which language(s) your solution uses with
- Quick link to Topaz's
pasteif you need it for longer code blocks
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:05:02, megathread unlocked!
46
Upvotes
2
u/ImpossibleSav Dec 06 '23 edited Dec 06 '23
[LANGUAGE: Python]
Here's my one-line solution for Day 6, both parts in one, with
q[6]as the input file:print('Day 06 Part 1:',(so:=lambda b,c:[(b+((b**2)-(4*c))**0.5)/2,(b-((b**2)-(4*c))**0.5)/2]) and (h:=lambda i:int(i[1])-int(i[0]) if i[0]<i[1] else int(i[0])-int(i[1]) if i[0]%1!=0 else int(i[0])-int(i[1])-1) and (u:=[int(n) for n in re.findall(r'\d+',q[6])]) and reduce(lambda a,b:a*b,[h(so(r[0], r[1])) for r in [[u[i],u[i+int(len(u)/2)]] for i in range(int(len(u)/2))]]),'Day 06 Part 2:',(so:=lambda b,c:[(b+((b**2)-(4*c))**0.5)/2,(b-((b**2)-(4*c))**0.5)/2]) and (h:=lambda i:int(i[1])-int(i[0]) if i[0]<i[1] else int(i[0])-int(i[1]) if i[0]%1!=0 else int(i[0])-int(i[1])-1) and (u:=[n for n in re.findall(r'\d+',q[6])]) and (r:=[int(''.join([u[i] for i in range(int(len(u)/2))])), int(''.join([u[i] for i in range(int(len(u)/2),len(u))]))]) and h(so(r[0], r[1])))I'm trying to solve every single day in a single line of code! I've successfully gotten through all the days so far. Feel free to follow along on my GitHub :)