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.
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 :)
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
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.
oh wow reading is clearly not my strong suit
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 :)
""Python will not save you" goes hard haha. Great videos!
Modifying the list during the loop is brilliant! This removes like 90% of my use cases for simple deque queues
I just moved everything recursively, but I didn’t realize I wouldn’t have to check if out of bounds tho
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
Would't iterating over reversed(targets[1:]) fix the need of the copy?
Thanks for your videos man
I think she asked to avoid using “man“ or “dude“ to refer to her :)
For modifying the grid, I did
grid, instr = file.read().split('
')
grid = [
row.replace("#", "##").replace(".", "..").replace("@", "@.").replace("O", "[]")
for row in grid.strip().splitlines()
]