Skip to content

Commit

Permalink
Add loop pic
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed-dash committed Jan 1, 2024
1 parent 87b120b commit c36f4e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Binary file added docs/assets/images/bfs_closed_loop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3490,9 +3490,13 @@
"\n",
"**Find the single giant loop starting at S. How many steps along the loop does it take to get from the starting position to the point farthest from the starting position?**\n",
"\n",
"**My solution:**\n",
"\n",
"This seems like a perfect case for a [BFS](https://aoc.just2good.co.uk/python/shortest_paths)!\n",
"\n",
"**My solution:**\n",
"I will BFS from the start position. My BFS should result in two paths being explored at the same time: i.e. because from any position in a closed loop, we can always walk in two directions.\n",
"\n",
"![BFS closed loop]((https://aoc.just2good.co.uk/assets/images/bfs_closed_loop.png))\n",
"\n",
"I'll make a `PipeGrid` class by extending my previous `Grid` class. In this class:\n",
"\n",
Expand Down

0 comments on commit c36f4e2

Please sign in to comment.