AoC 2023, Day 6, Wait for it
This puzzle is called Wait For It.
Part 1
In this puzzle, I can make use of units of measure. This will allow me to make sure I don’t get my time numbers mixed up with my distance numbers. Because F# does not have built-in units for milliseconds and milliseconds I can very easily define them myself.
I also want a type to hold the basic data for each rice that is extracted while parsing.
I need a couple of functions to help me pass the text into my Race
type.
The next function will calculate the distance the boat will travel, given the time it spends accelerating and time is spends moving.
I need to calculate each possible travel distance for each race.
I must count how many of each possible travel distances would win
Let me run this, and see what I get.
288
is the expected value for the test data.
My final answer is also correct, and I get another star.
Part 2
In part two, most calculations are exactly the same. We rather just has to run it as a single race, rather than a collection of races.
I will create a couple of more functions to parse the input text as a single race.
I will then run this, and see what I get.
71503
is correct, and I get another star for my final answer as well.