Skip to content

Commit

Permalink
Merge pull request #140 from wimglenn/2024/25
Browse files Browse the repository at this point in the history
day 25
  • Loading branch information
wimglenn authored Dec 31, 2024
2 parents a0f8212 + da14314 commit 54156c4
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
18 changes: 18 additions & 0 deletions aoc_wim/aoc2024/q25.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
--- Day 25: Code Chronicle ---
https://adventofcode.com/2024/day/25
"""
from aocd import data
from aoc_wim.zgrid import ZGrid


chunks = data.split("\n\n")
keys = []
locks = []
for chunk in chunks:
zs = set(ZGrid(chunk).z("#", first=False))
L = keys if chunk[0] == "." else locks
L.append(zs)

a = sum(1 for lock in locks for key in keys if not lock & key)
print("answer_a:", a)
41 changes: 41 additions & 0 deletions tests/2024/25/0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#####
.####
.####
.####
.#.#.
.#...
.....

#####
##.##
.#.##
...##
...#.
...#.
.....

.....
#....
#....
#...#
#.#.#
#.###
#####

.....
.....
#.#..
###..
###.#
###.#
#####

.....
.....
.....
#....
#.#..
#.#.#
#####
3
-

0 comments on commit 54156c4

Please sign in to comment.