Advent of Code 2024 | Day 15 "Warehouse Woes"

Поделиться
HTML-код
  • Опубликовано: 4 фев 2025

Комментарии • 12

  • @GregorGramlich
    @GregorGramlich Месяц назад +10

    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  Месяц назад +7

      oh wow reading is clearly not my strong suit

  • @oldmajor5240
    @oldmajor5240 Месяц назад +9

    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 :)

  • @terryaney73
    @terryaney73 Месяц назад

    I battled forever before coming here. I read "For these larger boxes, distances are measured from the edge of the map to the closest edge of the box in question." as calculating left edge of map to left edge of box and right edge of map to right edge of map then taking the minimum of that. I see you just calculated left map to left edge. When I did same, I finally hit it. I was going insane.

  • @bloodypeanuts2593
    @bloodypeanuts2593 Месяц назад

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

  • @taxatogaming
    @taxatogaming Месяц назад

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

  • @reversev9778
    @reversev9778 Месяц назад +1

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

  • @eavdmeer
    @eavdmeer Месяц назад

    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 Месяц назад +1

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

  • @juanecoperu
    @juanecoperu Месяц назад +3

    Thanks for your videos man

    • @MagicWazam
      @MagicWazam Месяц назад +11

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

  • @yajusgakhar6969
    @yajusgakhar6969 Месяц назад +1

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

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