Ceres Search [Day 4 - Advent of Code 2024 - Python] @0xdf
Ceres Search [Day 4 - Advent of Code 2024 - Python]  @0xdf
Uploaded December 2024 | Updated November 2026, 3 hours ago
I am given a large block of text containing a bunch of X, M, A, and S. In part 1, I have to find every instance of the word XMAS and return the count. In part 2, I need to search for places where two instances of the word MAS are crossed at the A, like:
M S
A
M S

I'll start by creating sets for each of the letters with all the points they are located at, which is a nice mapping to work with. In part 2, I'll use some lambda functions as helpers to make the checks more intuitive.

2024 AOC repo: gitlab.com/0xdf/aoc2024
2024 AOC Intro vide: youtube.com/watch?v=4XKZZrhhiQE
VSCode Debug video: youtube.com/watch?v=cNhtk2Ob4B8

☕ Buy Me A Coffee: buymeacoffee.com/0xdf

[00:00] Part1 introduction
[00:46] Setup / data overview
[01:27] Making char_map
[02:37] Counting XMAS
[05:54] Solving part 1
[06:25] Slight part 1 improvement
[06:52] Part 2 challenge
[07:29] Start counting X-MAS
[08:01] Creating helper functions
[09:38] Counting X-MAS
[11:42] Solving part 2
[11:53] Conclusion

#adventofcode #python
Ceres Search [Day 4 - Advent of Code 2024 - Python]JinjaCare - HackTheSystem CTFGameover(lay) Exploit ExplainedGift Shop [AOC2025 Day 2]Crossed Wires [Day 24 - Advent of Code 2024 - Python]Exploiting CVE-2023-40028 [LinkVortex - HackTheBox]Day 9 - Explosions in Cyberspace [Revival of Code 2023 - Advent of Code 2016]Tracing Automations in HackTheBox Mailroom [Beyond Root]Christmas Tree Farm [AOC2025 Day 12]Simple Use After Free Exploitation [Hackvent 2022 - Day 21]Factory [AOC2025 Day 10]Introduction [Revival of Code 2023 - Advent of Code 2016]
0xdf |

Ceres Search [Day 4 - Advent of Code 2024 - Python]

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER