summaryrefslogtreecommitdiff
path: root/2018/aoc18-d03.py
diff options
context:
space:
mode:
authorihaveslowbrain <gitserver@ihaveslowbrain.com>2023-10-20 21:32:41 +0000
committerihaveslowbrain <gitserver@ihaveslowbrain.com>2023-10-20 21:32:41 +0000
commitd7fef5244c43526e4f1102f816130f55cf20e8a7 (patch)
treef8668a90bcb9abb34f94ced31900151348f39998 /2018/aoc18-d03.py
parent61073dcec8e896b84fafbd6110e2da55a0dd2d5e (diff)
renamed few files
Diffstat (limited to '2018/aoc18-d03.py')
-rw-r--r--2018/aoc18-d03.py77
1 files changed, 0 insertions, 77 deletions
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);
-