A quick follow up to Advent of Code 2023: testing and timing.

It’s been bothering me a bit that I haven’t had a generic way to run tests and timing on every problem as I’m going.

So let’s fix it!

A quick follow up to Advent of Code 2023: testing and timing.

It’s been bothering me a bit that I haven’t had a generic way to run tests and timing on every problem as I’m going.

So let’s fix it!

Full solution for today (spoilers!)

Given an undirected graph, find 3 edges that split the graph into two connected components. Return the product of the component’s sizes.

Full solution for today (spoilers!)

Given a set of 3D vectors (origin + velocity), count how many times the vectors would intersect. Ignore the Z-coordinate for this part; the collisions do not have to be at the same time.

Full solution for today (spoilers!)

Find the longest non-overlapping path through a maze with walls (

`#`

) and one way paths (`^v<>`

).

Full solution for today (spoilers!)

Given a series of 3D blocks, allow them to fall until the simulation is stable. Any cube of a block is sufficient to support another block, ignore rotations etc.

How many blocks are not the sole supporter for any other block?

Full solution for today (spoilers!)

Given a(n infinite) grid of walls

`#`

, count how many points can be reached by exactly 64 steps from a starting point.

Full solution for today (spoilers!)

Simulate a virtual circuit with

`high`

and`low`

pulses and four kinds of chips:

- Broadcast - Re-transmit all pulses
- Flip-flops - On a
`low`

pulse, toggle internal state; if it was on, send`high`

; otherwise send`low`

- Conjunction - Remember input from each attached module; if all inputs were
`high`

, send a`low`

, otherwise send`high`

- Output - Do nothing; just receive pulses
Count the product of

`low`

and`high`

pulses sent after 1000`low`

inputs to`broadcaster`

.

Full solution for today (spoilers!)

You are given a series of parts with 4 ratings as such:

`{x=787,m=2655,a=1222,s=2876}`

In addition, you are given a series of rules describing a graph as such:

`px{a<2006:qkq,m>2090:A,rfg}`

In this example, if you are at the node

`px`

, if`a < 2006`

, move to`qkq`

. Otherwise, if`m > 2090`

move to`A`

. If no other case matches, the last defaults to`rfg`

.

`A`

and`R`

are special cases for accept and reject.Calculate the sum of sum of all four ratings for all nodes that end at

`Accept`

.

Full solution for today (spoilers!)

Given a sequence of direction + distance that draws a polygon, calculate the area.

Full solution for today (spoilers!)

Given a grid of costs, find the shortest path from top left to bottom right. You may not double back or go straight more than 3 steps in a row.