From d7fef5244c43526e4f1102f816130f55cf20e8a7 Mon Sep 17 00:00:00 2001 From: ihaveslowbrain Date: Fri, 20 Oct 2023 21:32:41 +0000 Subject: renamed few files --- 2018/aoc18-d03.py | 77 ------------------------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 2018/aoc18-d03.py (limited to '2018/aoc18-d03.py') diff --git a/2018/aoc18-d03.py b/2018/aoc18-d03.py deleted file mode 100644 index c304576..0000000 --- a/2018/aoc18-d03.py +++ /dev/null @@ -1,77 +0,0 @@ -import numpy as np - -f = open("input"); - -GRIDSIZE = 1000; - -cloth = np.full((GRIDSIZE,GRIDSIZE),0, dtype=int); - - -part1 = np.count_nonzero(cloth); -print(part1); - -for i in f: - for l in range(len(i)): - if i[l] == "@": - claim_id = int(i[1:(l)]); - l_at = l+1; - if i[l] == ",": - claim_l = int(i[l_at:(l)]); - l_at = l+1; - if i[l] == ":": - claim_t = int(i[l_at:(l)]); - l_at = l+1; - if i[l] == "x": - claim_w = int(i[l_at:(l)]); - #l_at = l+1; - claim_h = int(i[l+1:]); - - for x in range(claim_l, claim_l+claim_w, 1): - for y in range(claim_t, claim_t+claim_h, 1): - cloth[y,x] +=1; - -part1 = np.count_nonzero(cloth); -#print(part1); -part1 = 0; -for i in range(GRIDSIZE): - for j in range(GRIDSIZE): - part1 += 1*(cloth[i,j] > 1); - - -print("part1", part1); - - -f = open("input"); -for i in f: - #print(i); - for l in range(len(i)): - #print(l, i[l]); - if i[l] == "@": - claim_id = int(i[1:(l)]); - l_at = l+1; - if i[l] == ",": - claim_l = int(i[l_at:(l)]); - l_at = l+1; - if i[l] == ":": - claim_t = int(i[l_at:(l)]); - l_at = l+1; - if i[l] == "x": - claim_w = int(i[l_at:(l)]); - #l_at = l+1; - claim_h = int(i[l+1:]); - - #checkclaim = "#" + str(claim_id) +" @ "+str(claim_l)+","+str(claim_t)+": "+str(claim_w)+"x"+str(claim_h); - #print("",i, checkclaim); - #print(); - is_overlap = False; - for x in range(claim_l, claim_l+claim_w, 1): - for y in range(claim_t, claim_t+claim_h, 1): - if (cloth[y,x] > 1): - is_overlap = True; - - if not is_overlap: - part2 = claim_id; - break; - -print("part2", part2); - -- cgit v1.2.3