Expand description

This is my solution for Advent of Code - Day 1: Trebuchet?

parse_line does most of the heavy lifting, using the provided regex to find digits in a line, and then turn those into a calibration value. It defers to overlapping_matches to handle getting regex matches that might overlap. sum_calibration_values reduces the values into the final puzzle answer.

ValueExtractors are used to codify the different logic for the two parts, see part_1_extractor and part_2_extractor.

Structs

  • Describes how to find digits in a string, and how to turn those into their numeric representation

Functions

  • Return regex matches that might overlap
  • parse_line 🔒
    Use the logic in the provided extractor to find all matches, then take the first and last and combine them into a two digit number.
  • The entry point for running the solutions with the ‘real’ puzzle input.
  • Reduce the value extracted in each line to the sum required as the puzzle answer.