r/adventofcode • • Dec 06 '23

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

THE USUAL REMINDERS


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 Ante challenge: 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.

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!

45 Upvotes

1.2k comments sorted by

View all comments

Show parent comment

1

u/remy_porter Dec 06 '23

Instead of testing for squares, you can also subtract a very small value, which while it won't work for every possible dataset it works well enough for the amount of sample data we have. Like just blindly throw -0.00000001 in there, instead of calling is_square and it'll work.

1

u/__makes Dec 06 '23

Yeah that would work. Just not a big fan of magic numbers. Maybe sys.float_info.epsilon could be used?

1

u/remy_porter Dec 06 '23

Probably a better choice, yeah. This was a quick "meh, need to defeat ties, I'll just subtract something small real quick".