summaryrefslogtreecommitdiff
path: root/2024/04/python/main.py
diff options
context:
space:
mode:
authormhsn <mail@mhsn.net>2025-09-12 20:20:58 +0100
committermhsn <mail@mhsn.net>2025-09-12 20:36:09 +0100
commit6b733982f9f240c1c97f1fa705bfbe4cd93c640e (patch)
treedad623203c8bb40f372e0ea14479c2f564efda79 /2024/04/python/main.py
parent9299c4ef655b88eb8b571864c939c78b27f77723 (diff)
downloadaoc-6b733982f9f240c1c97f1fa705bfbe4cd93c640e.tar.gz
aoc-6b733982f9f240c1c97f1fa705bfbe4cd93c640e.zip
simplify python file structure
Diffstat (limited to '2024/04/python/main.py')
-rw-r--r--2024/04/python/main.py27
1 files changed, 0 insertions, 27 deletions
diff --git a/2024/04/python/main.py b/2024/04/python/main.py
deleted file mode 100644
index cc04f04..0000000
--- a/2024/04/python/main.py
+++ /dev/null
@@ -1,27 +0,0 @@
-from fileinput import input
-
-grid = {
- complex(idx, idy): c
- for idy, line in enumerate(input())
- for idx, c in enumerate(line.strip())
-}
-dirs = {complex(dx, dy) for dx in [-1, 0, 1] for dy in [-1, 0, 1]}
-
-
-def xmas(x, v):
- return all(grid.get(x + n * v) == c for n, c in enumerate("XMAS"))
-
-
-def x_mas(x, v):
- return (
- grid.get(x) == "A"
- and grid.get(x + v) == grid.get(x + 1j * v) == "M"
- and grid.get(x - v) == grid.get(x - 1j * v) == "S"
- )
-
-
-silver = sum(xmas(x, v) for x in grid.keys() for v in dirs)
-gold = sum(x_mas(x, v) for x in grid.keys() for v in dirs if abs(v) > 1)
-
-print("silver:", silver)
-print("gold:", gold)