From 4c9a134bd4b790bf1b7e08aa5aac73c96f603337 Mon Sep 17 00:00:00 2001 From: FrederikBaerentsen Date: Sat, 14 Dec 2024 22:46:24 +0100 Subject: [PATCH] Removed old code --- 2015/day6/part1.py | 50 ---------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 2015/day6/part1.py diff --git a/2015/day6/part1.py b/2015/day6/part1.py deleted file mode 100644 index 109050e..0000000 --- a/2015/day6/part1.py +++ /dev/null @@ -1,50 +0,0 @@ -import sys -from pprint import pprint -import re -from itertools import product -from collections import defaultdict - -instructions = [] - -with open(sys.argv[1]) as file: - tmp = [] - for line in file: - tmp = [re.match(r'.+?(?=\d)',line).group().strip()] - tmp += [int(i) for i in re.findall(r'\d+',line)] - instructions.append(tmp) - -print(instructions) -size = 1000 - -maps = defaultdict(bool) -#maps = [ [False]*size for i in range(size)] - - -for i in instructions: - for x in product(range(i[1],i[3]+1),range(i[2],i[4]+1)): - if i[0] == 'turn off': - maps[x] = False - elif i[0] == 'turn on': - maps[x] = True - else: - if maps[x] == True: - maps[x] = False - else: - maps[x] = True - - #for y in range(i[1],i[3]+1): - # for x in range(i[2],i[4]+1): - # if i[0] == 'turn off': - # maps[x][y] = False - # elif i[0] == 'turn on': - # maps[x][y] = False - # else: - # maps[x][y] = True if maps[x][y] == False else maps[x][y] == True - -count = 0 - -for i in product(range(0,size),range(0,size)): - if maps[i] == True: - count += 1 - -print(count)