mirror of
https://github.com/thib8956/advent-of-code.git
synced 2025-08-23 16:01:59 +00:00
finish to make 2020 compatible with run.py
This commit is contained in:
@@ -52,7 +52,7 @@ def generate_floating_addresses(address):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
with open("input.txt") as infile:
|
import fileinput
|
||||||
print(part1(infile))
|
lines = [x for x in fileinput.input()]
|
||||||
infile.seek(0)
|
print(part1(lines))
|
||||||
print(part2(infile))
|
print(part2(lines))
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
Stack trace:
|
|
||||||
Frame Function Args
|
|
||||||
00600000010 001800617BE (00180251890, 0018023DFD1, 00000000058, 000FFFFB770)
|
|
||||||
00600000010 001800490FA (00000000000, 00100000000, 00000000000, 00000000001)
|
|
||||||
00600000010 00180049132 (00000000000, 00000000000, 00000000058, 0018031F2C0)
|
|
||||||
00600000010 0018006D9C9 (0000000000A, 000FFFFC940, 001800458BF, 00000000000)
|
|
||||||
00600000010 0018006DB92 (00000000003, 000FFFFC940, 001800458BF, 000FFFFC940)
|
|
||||||
00600000010 0018006EA4C (000FFFFC940, 001802405E5, 001800EAF57, 0000000000D)
|
|
||||||
00600000010 001800596A6 (000FFFF0000, 00000000000, 00000000000, 773CE092FFFFFFFF)
|
|
||||||
00600000010 0018005A9C5 (00000000002, 0018031EBD0, 001800BE5F9, 00600040000)
|
|
||||||
00600000010 0018005AE89 (001800C7664, 00000000000, 00000000000, 00000000000)
|
|
||||||
000FFFFCCE0 0018005B149 (000FFFFCE00, 00000000000, 00000000030, 0000000002F)
|
|
||||||
000FFFFCCE0 00180049877 (00000000000, 00000000000, 00000000000, 00000000000)
|
|
||||||
000FFFFFFF0 001800482C6 (00000000000, 00000000000, 00000000000, 00000000000)
|
|
||||||
000FFFFFFF0 00180048374 (00000000000, 00000000000, 00000000000, 00000000000)
|
|
||||||
End of stack trace
|
|
@@ -7,8 +7,8 @@ identify invalid nearby tickets by considering only whether tickets contain valu
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main(content):
|
||||||
rules, my_ticket, other_tickets = open("input.txt").read().split("\n\n")
|
rules, my_ticket, other_tickets = content.split("\n\n")
|
||||||
rules = parse_fields(rules)
|
rules = parse_fields(rules)
|
||||||
my_ticket = my_ticket.splitlines()[1]
|
my_ticket = my_ticket.splitlines()[1]
|
||||||
other_tickets = other_tickets.splitlines()[1:]
|
other_tickets = other_tickets.splitlines()[1:]
|
||||||
@@ -102,4 +102,7 @@ def remove_item(candidates, item):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
import sys
|
||||||
|
with open(sys.argv[1]) as f:
|
||||||
|
main(f.read())
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user