summaryrefslogtreecommitdiffstats
path: root/prog/aoc/23/13
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2023-12-17 23:17:03 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2023-12-17 23:17:03 +0100
commitb0324289066876915efb84a133eca039d8e8c8ee (patch)
tree76b06718de422ed0e5aacbd76c611ee4f82ff526 /prog/aoc/23/13
parentaoc11 (diff)
downloadr-b0324289066876915efb84a133eca039d8e8c8ee.tar
r-b0324289066876915efb84a133eca039d8e8c8ee.tar.gz
r-b0324289066876915efb84a133eca039d8e8c8ee.tar.bz2
r-b0324289066876915efb84a133eca039d8e8c8ee.tar.lz
r-b0324289066876915efb84a133eca039d8e8c8ee.tar.xz
r-b0324289066876915efb84a133eca039d8e8c8ee.tar.zst
r-b0324289066876915efb84a133eca039d8e8c8ee.zip
Diffstat (limited to 'prog/aoc/23/13')
-rwxr-xr-xprog/aoc/23/13/1.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/prog/aoc/23/13/1.py b/prog/aoc/23/13/1.py
new file mode 100755
index 0000000..14f231e
--- /dev/null
+++ b/prog/aoc/23/13/1.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python3
+from sys import stdin
+data = stdin.read()[:-1]
+patterns = []
+for datum in data.split("\n\n"):
+ patterns.append(datum.split("\n"))
+def try_gap(pattern, gap):
+ for l in range(gap+1):
+ if pattern[gap-l] != pattern[line+l+1]:
+ return False
+ return True
+def transpose(pattern):
+ r = []
+ for column in range(len(pattern[0])):
+ l = ""
+ for line in range(len(pattern)):
+ l += pattern[line][column]
+ r.append(l)
+ return r
+for pattern in patterns:
+ for line in len(pattern):
+ try_line(line