Shoelace, Pick, and Enumerators - Day 18 - Advent of Code 2023

In this Advent of Code 2023 video, you’ll learn how to solve the "Lava Duct Lagoon" puzzle from Day 18. We walk through calculating the area of a complex polygon shape based on a set of digging instructions.


The key techniques and concepts covered are:
- Parsing direction, step count, and color instructions
- Visualizing the polygon by drawing it on a grid
- Applying the Shoelace Formula to calculate interior area
- Using Pick's Theorem to count interior dots
- Switching to an Enumerator/Generator for better performance
- Yielding instructions instead of materializing a huge array
- Keeping a wall-length counter to enable Pick's Theorem

We’ll start with the sample input, walking through the instructions visually, then extend it to handle the full input efficiently using enumerators.

Shoelace Formula https://en.wikipedia.org/wiki/Shoelace_formula
Pick's theorem https://en.wikipedia.org/wiki/Pick%27s_theorem

Advent of Code: https://adventofcode.com/
My Solutions: https://gist.github.com/cjavdev/d15a2a4ffed6c840c2fb28a093e9f927/
Playlist https://www.youtube.com/playlist?list=PLS6F722u-R6KYlGyUv65EFpGKl2Esmurr

#adventofcode #ruby