Day 13: Point of Incidence

AdventuRust - AoC 2023

This is Day 13 of Advent of Code 2023! If you would like to solve the problems before looking at the solution, you can find them here.

In part 1 of Day 13, we have symmetries! We have been given a file with multiple matrices, each made up of dots and hashes, and each of them has a single line of symmetry associated with it. As a data cleaning exercise, I add hyphens between each character for my own ease of understanding. In order to find the axis of symmetry, I went through each line and listed out the potential axes of symmetry - if the intersection of all these lists contained a value, we have our answer, if not, the axis is between two rows, and we transpose the matrix and parse it again. As I write this post, I realize that I didn't check for the non-existence of a vertical axis before looking for a horizontal axis, but it was pretty fast regardless, so no harm done. Click here to jump to the part 2 discussion.

For part 2 of Day 13, we have smudge in the matrix, and we need to find out a new axis of symmetry by flipping one element in the matrix - the confusing part here was that the new axis of symmetry had to be different from the old axis of symmetry, took me a bit of debugging and rereading to figure that out. Outside of that, just the same as part 1 but took a few seconds takes instead of being instantaneous.

That's all folks! If you made it this far, enjoy some AI art generated by u/encse using the prompt for this puzzle.