Advent of Code 2022 Day 17 (#7/#8) Walk-Through

Поділитися
Вставка
  • Опубліковано 16 січ 2025

КОМЕНТАРІ • 12

  • @hyper-neutrino
    @hyper-neutrino  2 роки тому +13

    Video quality today is a bit lower than I'd admittedly like, and I apologize for that. I don't have time to script these and I'm a bit tired after all of my exams and this was recorded at 2 AM (which is also why I'm quieter than usual); I may start uploading my videos around noon instead in the future since these problems are starting to take a long time to solve and especially create a solution that I can show on the channel.

    • @flwi
      @flwi 2 роки тому +4

      No worries! I really appreciate the effort you put into these videos in order for others to learn! I hope your exams went well 🤞 Did you finish first? ;-)

    • @fredoverflow
      @fredoverflow 2 роки тому +1

      I actually love the little live debuggings; way more interesting than 30 minutes of unrealistic perfection!

    • @hyper-neutrino
      @hyper-neutrino  2 роки тому

      @@flwi Haha, no, I didn't finish my exam early. Hoping I didn't mess up too much stuff, I was probably underprepared for it though :) Thanks for the kind comment though!

    • @hyper-neutrino
      @hyper-neutrino  2 роки тому

      @@fredoverflow Thank you for your feedback! That is true, I think there is value in seeing both that people at the top of the leaderboard do still make mistakes, and also more importantly how to find these mistakes.

  • @iwatchedthevideo7115
    @iwatchedthevideo7115 2 роки тому +4

    Very interesting and useful! Never thought about using complex numbers like this. Would love to see a video on its principles and applications in coding, like the great one you did on mod arithmetic!

  • @jeancharles6378
    @jeancharles6378 2 роки тому

    Thank you, the explanation is amazing!

  • @szieberth-adam
    @szieberth-adam 2 роки тому

    For part 2, finally I checked for a repetition of full lines. The first horizontal rock is pretty good in giving them. Funny thing, the example jets will never produce any.

  • @kayebennett7867
    @kayebennett7867 2 роки тому +1

    In my case, I have almost the same solution. But in the first part, I used the itertools.cycle function (that essentially cycles through an iterator). So after defining jets=cycle(...) my loop is simply
    for rc in range(2022):
    jet = next(jets)
    I'm not sure if there is some disadvantage to doing it this way, but I think is much clearer (no nested loops and no need to check if rc>=2022)
    For the second part, I ran it for 10_000 rocks storing the difference and after that, I looked for the cycle. It's not the best solution but runs essentially instantly.

    • @hyper-neutrino
      @hyper-neutrino  2 роки тому

      Probably no disadvantage. I only learned about that yesterday, it seems very convenient and I can't imagine it having any performance issues.
      Yeah, the cycle is a bit shorter than what my solution will detect (and also my solution is just not very optimized). If I do revisit this year's AoC problems with a focus on optimization (which has been requested), I will keep other options in mind!

  • @lgmuk
    @lgmuk 2 роки тому

    I still couldn't understand the complex numbers and why it even works!

    • @diegorodriguezv
      @diegorodriguezv Рік тому +1

      Complex numbers are used here as 2D vectors. They have the advantage of being added and compared easily. I was confused at first too... :)