summaryrefslogtreecommitdiffstats
path: root/prog/aoc/23/13
diff options
context:
space:
mode:
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