Day 19 (cleanup)
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import re
|
|
||||||
|
|
||||||
lines = (x.strip() for x in open("input.txt"))
|
lines = (x.strip() for x in open("input.txt"))
|
||||||
rules = {}
|
rules = {}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import re
|
|
||||||
|
|
||||||
lines = (x.strip() for x in open("input.txt"))
|
lines = (x.strip() for x in open("input.txt"))
|
||||||
rules = {}
|
rules = {}
|
||||||
@@ -15,7 +14,8 @@ def yield_rule(line, rule, depth):
|
|||||||
|
|
||||||
|
|
||||||
def check(line, idx, depth=0):
|
def check(line, idx, depth=0):
|
||||||
if depth <= 100:
|
if depth > 100:
|
||||||
|
return
|
||||||
rs = rules[idx]
|
rs = rules[idx]
|
||||||
if isinstance(rs, str):
|
if isinstance(rs, str):
|
||||||
if line.startswith(rs):
|
if line.startswith(rs):
|
||||||
|
|||||||
Reference in New Issue
Block a user