From d265c1a18df6fae9fd22004f1f6fb770ca953877 Mon Sep 17 00:00:00 2001 From: Dazbo Date: Mon, 1 Jan 2024 22:52:35 +0000 Subject: [PATCH] Extra ideas for d10 --- src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb b/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb index b7433b1..eebb35c 100644 --- a/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb +++ b/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb @@ -3807,11 +3807,16 @@ "\n", "### Final Remarks and Useful Resources\n", "\n", - "There are a couple of other ways to solve this problem. \n", + "There are a few other ways to solve this problem. \n", "\n", - "- One approach is to use the **[non-zero winding rule](https://en.wikipedia.org/wiki/Nonzero-rule)** to determine whether a point falls within an enclosed curve.\n", + "- Horizontal [ray casting algorithm](https://www.youtube.com/watch?v=RSXM9bgqxJM): extend a virtual ray from left to right, and count how many times it intersects with the polygon. If the number of intersections is odd, then the line is inside the polygon. If it is even, it is outside of the polygon.\n", + "- Another approach is to use the **[non-zero winding rule](https://en.wikipedia.org/wiki/Nonzero-rule)** to determine whether a point falls within an enclosed curve.\n", "- This [Reddit post](https://www.reddit.com/r/adventofcode/comments/18fgddy/2023_day_10_part_2_using_a_rendering_algorithm_to/) from `tomi901` provides a **nice visual** to explain how to determine whether a point is in or out.\n", - "- One more option: you can **scale-up the entire grid by 3**. Every square is replaced by a 3x3 group of squares. The result is that loops that were adjacent now have a channel between them. This allows you to always flood fill to the outside, which makes elimination of _external_ tiles much easier." + "- One more option: you can **scale-up the entire grid by 3**. Every square is replaced by a 3x3 group of squares. The result is that loops that were adjacent now have a channel between them. This allows you to always flood fill to the outside, which makes elimination of _external_ tiles much easier.\n", + "\n", + "Additionally:\n", + "\n", + "- For simplicity, we could have easily replaced all non-loop pipe components with `.`. (Since we already know which points make up the loop itself.)" ] }, {