Module advent_of_code_2023::day_4
source · Expand description
This is my solution for Advent of Code - Day 4: Scratchcards
Scratchcard
handles parsing (Scratchcard::from
), and scoring (Scratchcard::match_count
and
Scratchcard::score
).
Part 1 is solved by sum_scores
, part 2 by calculate_total_cards
.
Structs
- Represents a scratchcard (one line of input)
Functions
- Part 2 solution - each card wins a copy of the next n cards where n is the number of winning matches. This is guaranteed not to overflow the list of available cards.
- Parse each line as a card
- The entry point for running the solutions with the ‘real’ puzzle input.
- Part 1 solution - calculate and sum the scores for all cards