Advent of Code 2024 – C# and Python (23 Part Series)
1 Advent of Code 24
2 Advent of Code 2024 – Day 1: Historian Hysteria
… 19 more parts…
3 Advent of Code 2024 – Day 2: Red-Nosed Reports
4 Advent of Code 2024 – Day 3: Mull it Over
5 Advent of Code 2024- Day 5: Print Queue
6 Advent of Code 2024: Day 6: Guard Gallivant
7 Advent of Code 2024 – Day7: Bridge Repair
8 Advent of Code 2024 – Day8: Resonant Collinearity
9 Advent of Code ’24 – Day9: Disk Fragmenter (Python)
10 Advent of Code ’24 – Day 10: Hoof It
11 Advent of Code 2024 – Day 11: Plutonian Pebbles
12 Advent of Code ’24 – Day 13 Claw Contraption
13 Advent of Code 2024: Day 12: Garden Groups
14 Advent of Code 2024 – Day 14 : Restroom Redoubt
15 Advent of Code 2024 – Day 15: Warehouse Woes
16 Advent of Code 2024: Day 16 – Reindeer Maze
17 Advent of Code 2024 – Day 17: Chronospatial Computer
18 Advent of Code 2024 – Day 18: Ram Run
19 Advent of Code 2024 – Day 19: Linen Layout
20 Advent of Code 2024 – Day 20: Race Condition
21 Advent of Code 2024 – Day 21: Keypad Conundrum
22 Advent of Code 2024 – Day 22: Monkey Market
23 Advent of Code 2024 – Day 23: LAN Party
Day 15: Warehouse Woes
This puzzle wasn’t too difficult, I found myself just making a lot of functions and a lot of if statements and loops tbh.
It got to the point today where I was a bit tired out of 2D grid navigating, hence the lateness in posting this (i had to have a day off).
You can find my solution here as always.
Again, nothing too major to discuss today. The main concepts were:
a) navigate the grid looping over the instructions to determine which direction to move in.
b) keep track of where the boxes were, and checking to see if our next move was a wall or a box, if was a box check we can move the box or not.
Part 2:
a) apply the same logic, just with different parameters of being able to move two boxes at the same time as per puzzle instructions.
Key functions:
Find Boxes: The find_boxes
function identifies pairs of box halves ([ and ]), representing the left and right sides of boxes, and maps their relationships for use in box-pushing logic.
Move Robot in Second Warehouse
The move_robot_in_second_warehouse function extends robot logic to handle modified grids. It uses a more complex strategy for pushing boxes ([]) and ensuring sufficient space is available. It tracks box relationships and moves them collectively when needed.
Part 1 uses the basic grid and robot logic to compute a result based on the positions of boxes (O). Whereas, Part 2 processes a modified grid, applying advanced movement rules, and computes a similar result for boxes ([])
Not much more too it really, just a 2D grid navigation with a load of conditions and movements. On the plus side, I feel my Python knowledge is improving more so around syntax, and useful library functions.
As always feel free to reach out to me on Twitter
Advent of Code 2024 – C# and Python (23 Part Series)
1 Advent of Code 24
2 Advent of Code 2024 – Day 1: Historian Hysteria
… 19 more parts…
3 Advent of Code 2024 – Day 2: Red-Nosed Reports
4 Advent of Code 2024 – Day 3: Mull it Over
5 Advent of Code 2024- Day 5: Print Queue
6 Advent of Code 2024: Day 6: Guard Gallivant
7 Advent of Code 2024 – Day7: Bridge Repair
8 Advent of Code 2024 – Day8: Resonant Collinearity
9 Advent of Code ’24 – Day9: Disk Fragmenter (Python)
10 Advent of Code ’24 – Day 10: Hoof It
11 Advent of Code 2024 – Day 11: Plutonian Pebbles
12 Advent of Code ’24 – Day 13 Claw Contraption
13 Advent of Code 2024: Day 12: Garden Groups
14 Advent of Code 2024 – Day 14 : Restroom Redoubt
15 Advent of Code 2024 – Day 15: Warehouse Woes
16 Advent of Code 2024: Day 16 – Reindeer Maze
17 Advent of Code 2024 – Day 17: Chronospatial Computer
18 Advent of Code 2024 – Day 18: Ram Run
19 Advent of Code 2024 – Day 19: Linen Layout
20 Advent of Code 2024 – Day 20: Race Condition
21 Advent of Code 2024 – Day 21: Keypad Conundrum
22 Advent of Code 2024 – Day 22: Monkey Market
23 Advent of Code 2024 – Day 23: LAN Party
暂无评论内容