diff --git a/2024/Day04/README.md b/2024/Day04/README.md index b7d51154..470d6e8b 100644 --- a/2024/Day04/README.md +++ b/2024/Day04/README.md @@ -1,8 +1,11 @@ ## --- Day 4: Ceres Search --- -"Looks like the Chief's not here. Next!" One of The Historians pulls out a device and pushes the only button on it. After a brief flash, you recognize the interior of the [Ceres monitoring station](/2019/day/10)! - +"Looks like the Chief's not here. Next!" One of The Historians pulls out a device and pushes the only button on it. After a brief flash, you recognize the interior of the __Ceres monitoring station__! As the search for the Chief continues, a small Elf who lives on the station tugs on your shirt; she'd like to know if you could help her with her word search (your puzzle input). She only has to find one word: XMAS. -This word search allows words to be horizontal, vertical, diagonal, written backwards, or even overlapping other words. It's a little unusual, though, as you don't merely need to find one instance of XMAS - you need to find all of them. Here are a few ways XMAS might appear, where irrelevant characters have been replaced with .: - Read the [full puzzle](https://adventofcode.com/2024/day/4). + +I used my proven tactic and converted the input to a Dictionary keyed by coordinates. It's easy to iterate over the keys and checking if we are in the bounds of the map as well. + +Representing the coordinates with Complex numbers is also a useful way to deal with stepping in various directions. + +The algorithm itself is simply a bruteforce check of all starting positions and reading orders.