From b0324289066876915efb84a133eca039d8e8c8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Sun, 17 Dec 2023 23:17:03 +0100 Subject: =?UTF-8?q?=C5=A1ola?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prog/aoc/23/13/1.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 prog/aoc/23/13/1.py (limited to 'prog/aoc/23/13') 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 -- cgit v1.2.3