description.txt 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. --- Day 4: Ceres Search ---
  2. "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!
  3. 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.
  4. 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 .:
  5. ..X...
  6. .SAMX.
  7. .A..A.
  8. XMAS.S
  9. .X....
  10. The actual word search will be full of letters instead. For example:
  11. MMMSXXMASM
  12. MSAMXMSMSA
  13. AMXSXMAAMM
  14. MSAMASMSMX
  15. XMASAMXAMM
  16. XXAMMXXAMA
  17. SMSMSASXSS
  18. SAXAMASAAA
  19. MAMMMXMMMM
  20. MXMXAXMASX
  21. In this word search, XMAS occurs a total of 18 times; here's the same word search again, but where letters not involved in any XMAS have been replaced with .:
  22. ....XXMAS.
  23. .SAMXMS...
  24. ...S..A...
  25. ..A.A.MS.X
  26. XMASAMX.MM
  27. X.....XA.A
  28. S.S.S.S.SS
  29. .A.A.A.A.A
  30. ..M.M.M.MM
  31. .X.X.XMASX
  32. Take a look at the little Elf's word search. How many times does XMAS appear?
  33. Your puzzle answer was 2458.
  34. --- Part Two ---
  35. The Elf looks quizzically at you. Did you misunderstand the assignment?
  36. Looking for the instructions, you flip over the word search to find that this isn't actually an XMAS puzzle; it's an X-MAS puzzle in which you're supposed to find two MAS in the shape of an X. One way to achieve that is like this:
  37. M.S
  38. .A.
  39. M.S
  40. Irrelevant characters have again been replaced with . in the above diagram. Within the X, each MAS can be written forwards or backwards.
  41. Here's the same example from before, but this time all of the X-MASes have been kept instead:
  42. .M.S......
  43. ..A..MSMS.
  44. .M.S.MAA..
  45. ..A.ASMSM.
  46. .M.S.M....
  47. ..........
  48. S.S.S.S.S.
  49. .A.A.A.A..
  50. M.M.M.M.M.
  51. ..........
  52. In this example, an X-MAS appears 9 times.
  53. Flip the word search from the instructions back over to the word search side and try again. How many times does an X-MAS appear?
  54. Your puzzle answer was 1945.
  55. Both parts of this puzzle are complete! They provide two gold stars: **