advent_of_code_2024

Module day_13

source
Expand description

This is my solution for Advent of Code - Day 13: Claw Contraption

parse_input Uses Machine::from_str and Coords::from_str to build the input into a list of Machines.

sum_prize_costs solves both parts, taking an offset to be set to 10_000_000_000_000 for part 2. This uses Machine::get_cost_for_prize, and Machine::get_presses to solve the machine’s equations.

Structs§

  • Coords 🔒
    A pair of 2d coordinates. Used for the button press delta’s and the prize target
  • Machine 🔒

Functions§

  • Turn the puzzle input into a list of machines by parsing each block separated by a blank line
  • The entry point for running the solutions with the ‘real’ puzzle input.
  • Use Machine::get_cost_for_prize to get the total cost over all valid machines