Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
encse authored Dec 4, 2024
1 parent b316bdc commit 7e9b55f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions 2024/Day04/README.md
Original file line number Diff line number Diff line change
@@ -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 <em>word search</em> (your puzzle input). She only has to find one word: <code>XMAS</code>.

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 <code>XMAS</code> - you need to find <em>all of them</em>. Here are a few ways <code>XMAS</code> might appear, where irrelevant characters have been replaced with <code>.</code>:

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.

0 comments on commit 7e9b55f

Please sign in to comment.