Advent of Code 2024 | Day 15 "Warehouse Woes"

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

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

  • @GregorGramlich
    @GregorGramlich วันที่ผ่านมา +5

    12:00 As you mention multiple times that the problem statement says that the robot is twice as wide. It does not, it says "everything except the robot is twice as wide!"
    Thanks for taking the time to record your solutions and explanations. I've learned a lot.

    • @hyper-neutrino
      @hyper-neutrino  19 ชั่วโมงที่ผ่านมา +3

      oh wow reading is clearly not my strong suit

  • @oldmajor5240
    @oldmajor5240 วันที่ผ่านมา +6

    Fun fact: You can also do part 2 in place. I just did a normal bfs to find which of the boxes will be moved and then if there is no blockage, I just iterated over the boxes in reverse temporal order. This way, you don't have to worry, about overlapping boxes :)

  • @taxatogaming
    @taxatogaming 16 ชั่วโมงที่ผ่านมา

    ""Python will not save you" goes hard haha. Great videos!

  • @bloodypeanuts2593
    @bloodypeanuts2593 20 ชั่วโมงที่ผ่านมา

    Modifying the list during the loop is brilliant! This removes like 90% of my use cases for simple deque queues

  • @reversev9778
    @reversev9778 18 ชั่วโมงที่ผ่านมา +1

    I just moved everything recursively, but I didn’t realize I wouldn’t have to check if out of bounds tho

  • @eavdmeer
    @eavdmeer 20 ชั่วโมงที่ผ่านมา

    In the first part, the robot doesn't need to be added to the *target* list, as it will be moved separately. Also, you only need to add the *last* box in the *target* array to the grid. No sense overwriting 'O' with 'O' for the other entries. Of course, that doesn't work for part 2.
    I used a BFS for part 2 and moved everything in reverse order

  • @FirSouL3
    @FirSouL3 วันที่ผ่านมา

    Would't iterating over reversed(targets[1:]) fix the need of the copy?

  • @juanecoperu
    @juanecoperu วันที่ผ่านมา +3

    Thanks for your videos man

    • @MagicWazam
      @MagicWazam วันที่ผ่านมา +6

      I think she asked to avoid using “man“ or “dude“ to refer to her :)

  • @yajusgakhar6969
    @yajusgakhar6969 4 ชั่วโมงที่ผ่านมา

    For modifying the grid, I did
    grid, instr = file.read().split('

    ')
    grid = [
    row.replace("#", "##").replace(".", "..").replace("@", "@.").replace("O", "[]")
    for row in grid.strip().splitlines()
    ]