# AoC 2023, Day 6, Wait for it

This puzzle is called Wait For It. open System let sampleText = "Time: 7 15 30 Distance: 9 40 200" 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.

# AoC 2023, Day 5, Fertilizer

I am currently quite a few days behind. I will try catching up bit by bit. My first attempt at the Day 5 puzzle, called If You Give A Seed A Fertilizer did not go so well, so this is my second attempt. Part 1 # let sampleText = "seeds: 79 14 55 13 seed-to-soil map: 50 98 2 52 50 48 soil-to-fertilizer map: 0 15 37 37 52 2 39 0 15 fertilizer-to-water map: 49 53 8 0 11 42 42 0 7 57 7 4 water-to-light map: 88 18 7 18 25 70 light-to-temperature map: 45 77 23 81 45 19 68 64 13 temperature-to-humidity map: 0 69 1 1 0 69 humidity-to-location map: 60 56 37 56 93 4" I want to create a couple of types, a map entry type and a map type, this is to hold the input data.

# AoC 2023, Day 4, Scratchcards

Today’s puzzle is called Scratchcards. Part 1 # I am going to start by creating a type called card to store the information in. type Card = Card of no: int * winners: int [] * mine: int [] I need to be able to parse the card text, This could be done more elegant, but I’m going to split the string up, and assume there is no problem in the input data.

# AoC 2023, Day 3, Gear Ratios

Today’s puzzle is called Gear Ratios. Part 1 # I am going to start by declaring a couple of types to help me. A digit can be a SymboolDigit or a NonSymbolDigit, where a SymbolDigit will be any digit with a symbol around it. open System type Digit = SymbolDigit of char | NonSymbolDigit of char type Number = PartNumber of string | OtherNumber of string I also want a few helper functions.

# AoC 2023, Day 2, Cube Conundrum

Today’s puzzle is Cube Conundrum. Part 1 # I will start by defining a few types, cube, game. type Set = Set of red: int * green: int * blue: int type Game = Game of no: int * sets: Set list I need a way to see if a given game is valid (a game is valid if all sets in the game are valid). let validSet (Set (bagRed, bagGreen, bagBlue)) (Set (setRed, setGreen, setBlue)) = setRed <= bagRed && setGreen <= bagGreen && setBlue <= bagBlue let validGame bag (Game (no, sets)) = if Seq.

# AoC 2023, Day 1, Trebuchet

It is the first of December, and that means the start of Advent of Code. I am going to make an attempt at this every day, posting my coding solutions (as much as possible in F#). I will not be posting the questions, as they can be found online, and I will not be posting my final answer. The first question is called Trebuchet. Part 1 # I will first need a function that will be able to grab the first and last digits from a single row string.