Day 19 (bug fix)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
lines = (x.strip() for x in open("input.txt"))
|
lines = (x.strip() for x in open("input.txt"))
|
||||||
rules = {}
|
rules = {}
|
||||||
sum = 0
|
cnt = 0
|
||||||
|
|
||||||
|
|
||||||
def yield_rule(line, rule):
|
def yield_rule(line, rule):
|
||||||
@@ -30,7 +30,5 @@ for line in lines:
|
|||||||
r = r[1:len(r)-1] if r.startswith('"') else [list(map(int, x.split())) for x in r.split(" | ")]
|
r = r[1:len(r)-1] if r.startswith('"') else [list(map(int, x.split())) for x in r.split(" | ")]
|
||||||
rules[idx] = r
|
rules[idx] = r
|
||||||
elif line != "":
|
elif line != "":
|
||||||
for rest in check(line, 0):
|
cnt += 1 if next(check(line, 0), None) == "" else 0
|
||||||
if rest == "":
|
print(cnt)
|
||||||
sum += 1
|
|
||||||
print(sum)
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
lines = (x.strip() for x in open("input.txt"))
|
lines = (x.strip() for x in open("input.txt"))
|
||||||
rules = {}
|
rules = {}
|
||||||
sum = 0
|
cnt = 0
|
||||||
|
|
||||||
|
|
||||||
def yield_rule(line, rule, depth):
|
def yield_rule(line, rule, depth):
|
||||||
@@ -34,7 +34,5 @@ for line in lines:
|
|||||||
r = r[1:len(r)-1] if r.startswith('"') else [list(map(int, x.split())) for x in r.split(" | ")]
|
r = r[1:len(r)-1] if r.startswith('"') else [list(map(int, x.split())) for x in r.split(" | ")]
|
||||||
rules[idx] = r
|
rules[idx] = r
|
||||||
elif line != "":
|
elif line != "":
|
||||||
for rest in check(line, 0, len(line)):
|
cnt += 1 if next(check(line, 0, len(line)), None) == "" else 0
|
||||||
if rest == "":
|
print(cnt)
|
||||||
sum += 1
|
|
||||||
print(sum)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user