import sys import os sys.path.insert(1, os.path.abspath('../../')) from python_tools.aoc_utils import * def get_heights(i): count = [] for j in range(len(i[0])): height = -1 for x in range(len(i)): if i[x][j] == "#": height += 1 count.append(height) return count def check_fit(a, b): assert(len(a) == len(b)) for i in range(len(a)): if a[i]+b[i] >= 6: return False return True def part_one(input): locks = [] keys = [] for i in input: if "#" in i[0]: locks.append(get_heights(i)) elif "#" in i[-1]: keys.append(get_heights(i)) p1 = 0 for k in keys: for l in locks: if check_fit(l,k): p1+=1 print("P1: ", p1) def part_two(input): pass def main(): f = open("input.txt", 'r') temp = f.read() chunks = temp.split("\n\n") contents = [x.split() for x in chunks] part_one(contents) part_two(contents) if __name__ == "__main__": main()