Advent of Code 2023 Day 21: Step Counter

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ธ.ค. 2024

ความคิดเห็น • 27

  • @clec0917
    @clec0917 11 หลายเดือนก่อน +1

    This is a very elegant and very well explained solution, thanks a lot !

  • @thomasmichael3497
    @thomasmichael3497 11 หลายเดือนก่อน +3

    great work!

  • @maxxbrandt5822
    @maxxbrandt5822 11 หลายเดือนก่อน +2

    Actually a great puzzle this pt2 was, I was trying to solve it by calculating number of square grids and recombining the cut-off and missing triangles, but it didn't work until I realized that you can't recombine them, they're opposite parity! And then I was able to solve this by subtracting the even cut-off triangles and filling in the missing odd triangles. This solution requires 4 fills only - even and odd for square and rhombus inside that square.

    • @maxxbrandt5822
      @maxxbrandt5822 11 หลายเดือนก่อน

      It works because summing up all the same parity triangles from all sides creates "S / N" missing and "S / N + 1" cut-off squares (!) with a cut-out rhombus in the middle ^^ And summing it up like this works because the empty wide diagonals and scarcity of the grid actually prove that all triangles inside and outside diagonals are filled up in steps required to reach the diagonal.

  • @drmaxlwilson
    @drmaxlwilson 11 หลายเดือนก่อน +3

    you mentioned that you'd like to hear if other people take more general approaches. people have solved this with a quadratic equation. since you do a great job of explaining solutions, it'd be great to hear your take on it. also thanks for the videos - its great they are explanation focused recodes, rather than watching someone silently figure it out first time.

    • @drmaxlwilson
      @drmaxlwilson 11 หลายเดือนก่อน

      that said, it still seems to depend on the shape of the actual puzzle input, rather than generalise.

    • @hyper-neutrino
      @hyper-neutrino  11 หลายเดือนก่อน +2

      Thanks for this idea! Yeah, people in my Discord server raised this idea and it certainly seems very interesting; I'll definitely go over it in my next review stream. Like you said though, it does still require some assumptions, but it's a lot more general than my solution, and actually seems to work on the test input too. Glad you've been enjoying!

  • @Gusto20000
    @Gusto20000 11 หลายเดือนก่อน +3

    I've just noticed that this number of steps 26501365 - is actually 202300 x 131+ 65 - which means that it is 65 steps to the edge of the current field and exactly 202300 full fields ahead. And I bet there must be some kind of geometric grow of the answer, so I think I'll try to manually extend the input like 5x5 and see what kind of answers I'll get after 65+131 and 65+ 2x131 , 65+ 3x131 steps. I bet there will be some kind of dependency and possibility to calculate N-th step answer

    • @Gusto20000
      @Gusto20000 11 หลายเดือนก่อน +2

      And it worked, brute-forced till 327-th step, then used prediction algorithm from day10 and run it 202300 times.

  • @user-sk1ig6gk9w
    @user-sk1ig6gk9w 11 หลายเดือนก่อน

    at 14:24 I don't understand why you choose 4x4 instead of 2x2 for number of even grid. that 4x4 contain no full travel grid isn't it?

    • @hyper-neutrino
      @hyper-neutrino  11 หลายเดือนก่อน

      "If we add another layer around the outside..."

    • @user-sk1ig6gk9w
      @user-sk1ig6gk9w 11 หลายเดือนก่อน

      @@hyper-neutrino but why? isn't number of even grid only represent the grid that the entire plots travel? but from the diagram you clearly count the grid that suppose to be corner and edge that you also add to it later.

  • @dylans8786
    @dylans8786 11 หลายเดือนก่อน

    Just curious what application you are using when you write equations or draws diagrams? I like your solutions!

    • @hyper-neutrino
      @hyper-neutrino  11 หลายเดือนก่อน +3

      I use excalidraw

    • @jonathanduck5333
      @jonathanduck5333 11 หลายเดือนก่อน +1

      excalidraw

    • @dylans8786
      @dylans8786 11 หลายเดือนก่อน

      @@hyper-neutrino Thanks. It looks great on your videos

  • @terryaney73
    @terryaney73 11 หลายเดือนก่อน

    Curious...is your knowledge to come up with this solution due more to a strong math background or previous experience coding grid/game based movements?

    • @hyper-neutrino
      @hyper-neutrino  11 หลายเดือนก่อน +1

      A mix of both. This solution is more so from grid experience. There's actually a much nicer mathematical solution that I will visit during my next stream.

    • @terryaney73
      @terryaney73 11 หลายเดือนก่อน

      @@hyper-neutrino Thanks. If you remember, drop a note here. I'll watch for the video, but just in case.

  • @danieldiazbuzon3651
    @danieldiazbuzon3651 11 หลายเดือนก่อน

    If you are using VSCode, what theme and font you used? It seems awesome to me

    • @hyper-neutrino
      @hyper-neutrino  11 หลายเดือนก่อน

      Theme is GitHub Dark with Material Icons and the font is Monaspace Radon

  • @s1nc3r1ty
    @s1nc3r1ty 11 หลายเดือนก่อน

    I wondered if you could rotate the grid by 45 so that it would cut out all those edge bits....

    • @hyper-neutrino
      @hyper-neutrino  11 หลายเดือนก่อน

      Interesting. I don't think that'd be possible, because ultimately you will end up with partial sections of the original grid, and I don't think we can fix that.

    • @s1nc3r1ty
      @s1nc3r1ty 11 หลายเดือนก่อน

      I thought you might get the internal diamond (reached with 65 steps) and then the diamond of all the corner triangles. Also, I thought that those empty diagonal lines on the grid when you zoom out might suggest that this is an idea...

  • @kabirghai8709
    @kabirghai8709 11 หลายเดือนก่อน

    What's the code/package that allows you to run your code on both the input in white and the sample in blue?

    • @hyper-neutrino
      @hyper-neutrino  11 หลายเดือนก่อน +1

      It's a custom alias (you can find it in scripts.sh in my repository in the description)

  • @thekwoka4707
    @thekwoka4707 11 หลายเดือนก่อน

    Man, I've copied this exactly and it's still wrong...and I am smashing my head against the wall