Partly solve 2019:18
This commit is contained in:
parent
b9d32629c8
commit
86121d7799
1 changed files with 55 additions and 0 deletions
55
2019-python/output/day_18.py
Normal file
55
2019-python/output/day_18.py
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
from output import answer, matrix # D, DD, ADJ, ints, mhd, mdbg, vdbg
|
||||
|
||||
n = 18
|
||||
title = "Many-Worlds Interpretation"
|
||||
|
||||
|
||||
@answer(1, "Answer is {}")
|
||||
def part_1(outputs):
|
||||
return outputs[0]
|
||||
|
||||
|
||||
@answer(2, "Actually, answer is {}")
|
||||
def part_2(outputs):
|
||||
return outputs[1]
|
||||
|
||||
|
||||
def solve(data):
|
||||
M, h, w = matrix(data)
|
||||
p = None
|
||||
for r in range(h):
|
||||
for c in range(w):
|
||||
if M[r][c] == "@":
|
||||
p = (r, c)
|
||||
break
|
||||
if p:
|
||||
break
|
||||
print(p)
|
||||
|
||||
return None, None
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# use dummy data
|
||||
inp = """
|
||||
#########
|
||||
#b.A.@.a#
|
||||
#########
|
||||
""".strip()
|
||||
|
||||
# uncomment to instead use stdin
|
||||
# import sys; inp = sys.stdin.read().strip()
|
||||
|
||||
# uncomment to use AoC provided puzzle input
|
||||
# with open("./input/18.txt", "r") as f:
|
||||
# inp = f.read().strip()
|
||||
|
||||
inp = solve(inp)
|
||||
|
||||
a = part_1(inp)
|
||||
# b = part_2(inp)
|
||||
|
||||
# uncomment and replace 0 with actual output to refactor code
|
||||
# and ensure nonbreaking changes
|
||||
# assert a == 0
|
||||
# assert b == 0
|
||||
Loading…
Add table
Reference in a new issue