summaryrefslogtreecommitdiffstats
path: root/19
diff options
context:
space:
mode:
authorGustav Sörnäs <gusso230@student.liu.se>2019-12-23 08:12:59 +0100
committerGustav Sörnäs <gusso230@student.liu.se>2019-12-23 08:12:59 +0100
commit8a8772b56d31ae92d120778129db04fb378043dc (patch)
treeda87885fa1b68af99c2ff04525ff8cc16844c419 /19
parent7ba3e185247d29560b210848b977cf399f0d9fb7 (diff)
downloadaoc-8a8772b56d31ae92d120778129db04fb378043dc.tar.gz
Answers day 23
Diffstat (limited to '19')
-rw-r--r--19/py/d23.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/19/py/d23.py b/19/py/d23.py
index 14416e9..0effdc6 100644
--- a/19/py/d23.py
+++ b/19/py/d23.py
@@ -12,6 +12,7 @@ waiting = [False for _ in range(len(computers))]
prev_nat_x, prev_nat_y = -1, -1
nat_x, nat_y = 0, 0
+pt1 = False
while True:
for i in range(len(computers)):
c = computers[i]
@@ -31,6 +32,9 @@ while True:
addr, x, y = output_buffers[i]
output_buffers[i] = []
if addr == 255:
+ if not pt1:
+ print("pt1", y)
+ pt1 = True
nat_x, nat_y = x, y
else:
queues[addr].append(x)
@@ -49,6 +53,6 @@ while True:
queues[0].append(nat_x)
queues[0].append(nat_y)
if nat_y == prev_nat_y:
- print(nat_y)
+ print("pt2", nat_y)
sys.exit()
prev_nat_x, prev_nat_y = nat_x, nat_y