Skip to content

Commit

Permalink
Extra ideas for d10
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed-dash committed Jan 1, 2024
1 parent 8b5907f commit d265c1a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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.)"
]
},
{
Expand Down

0 comments on commit d265c1a

Please sign in to comment.