Expand description
This is my solution for Advent of Code - Day 12: Garden Groups
parse_input turns the input file it a Garden as a Vec<Vec<char>>.
Garden::find_regions splits the Garden into Regions. Garden::total_fencing_cost solves part 1 using
the data collected when finding the regions. Garden::total_fencing_cost_with_discount solves part 2, using
Region::count_edges to find the unique edges in a region by counting corners in the perimeter.
StructsΒ§
- Delta πImplement deltas as a struct to allow some convenient consts and functions to be defined
- Garden πA grid of plots containing regions of different crops
- Region πA region that is a set of orthogonally adjacent plots in a
Gardenwith the same crop. It stores the plots and number of units in the perimeter for use byGarden::total_fencing_cost.
EnumsΒ§
- Side πUse to track which side of the current plot has the edge being followed when walking the perimeter
FunctionsΒ§
- parse_
input πParse a text grid into aGarden - The entry point for running the solutions with the βrealβ puzzle input.