fix runner
This commit is contained in:
parent
dfe6dda514
commit
f9a7a56acf
@ -7,6 +7,7 @@ new:
|
||||
touch full/day{{ DAY }}.txt
|
||||
touch samples/day{{ DAY }}.txt
|
||||
|
||||
|
||||
run:
|
||||
/usr/bin/env python3 python/day{{ DAY }}.py
|
||||
|
||||
|
||||
|
@ -18,6 +18,8 @@ def main():
|
||||
with shared.elapsed_timer() as elapsed:
|
||||
part1(rows)
|
||||
print("🕒", elapsed())
|
||||
|
||||
rows = [row for row in shared.load_rows(1,True)]
|
||||
with shared.elapsed_timer() as elapsed:
|
||||
part2(rows)
|
||||
print("🕒", elapsed())
|
||||
|
@ -55,8 +55,9 @@ def part2(rows):
|
||||
def main():
|
||||
rows = [row for row in shared.load_rows(1)]
|
||||
with shared.elapsed_timer() as elapsed:
|
||||
#part1(rows)
|
||||
part1(rows)
|
||||
print("🕒", elapsed())
|
||||
rows = [row for row in shared.load_rows(1, True)]
|
||||
with shared.elapsed_timer() as elapsed:
|
||||
part2(rows)
|
||||
print("🕒", elapsed())
|
||||
|
@ -54,6 +54,8 @@ def main():
|
||||
with shared.elapsed_timer() as elapsed:
|
||||
part1(rows)
|
||||
print("🕒", elapsed())
|
||||
|
||||
rows = [row for row in shared.load_rows(2, True)]
|
||||
with shared.elapsed_timer() as elapsed:
|
||||
part2(rows)
|
||||
print("🕒", elapsed())
|
||||
|
@ -30,11 +30,18 @@ def minmax(l):
|
||||
return min(l), max(l)
|
||||
|
||||
|
||||
def load_rows(day):
|
||||
return [row for row in load(day)]
|
||||
def load_rows(day, part2=False):
|
||||
return [row for row in load(day,part2)]
|
||||
|
||||
|
||||
def load(day):
|
||||
def load(day, part2=False):
|
||||
if part2:
|
||||
path = Path(get_fname(day)+".part2")
|
||||
try:
|
||||
return path.read_text().rstrip().split("\n")
|
||||
except FileNotFoundError:
|
||||
# No part 2 file, use first file
|
||||
pass
|
||||
path = Path(get_fname(day))
|
||||
return path.read_text().rstrip().split("\n")
|
||||
|
||||
@ -43,9 +50,9 @@ def get_fname(day: int) -> str:
|
||||
import sys
|
||||
|
||||
if sys.argv[-1] == "--sample":
|
||||
return f"../samples/day{day:02}.txt"
|
||||
return f"samples/day{day:02}.txt"
|
||||
else:
|
||||
return f"../full/day{day:02}.txt"
|
||||
return f"full/day{day:02}.txt"
|
||||
|
||||
|
||||
#############
|
||||
|
@ -1,4 +0,0 @@
|
||||
1abc2
|
||||
pqr3stu8vwx
|
||||
a1b2c3d4e5f
|
||||
treb7uchet
|
@ -1,7 +1,4 @@
|
||||
two1nine
|
||||
eightwothree
|
||||
abcone2threexyz
|
||||
xtwone3four
|
||||
4nineeightseven2
|
||||
zoneight234
|
||||
7pqrstsixteen
|
||||
1abc2
|
||||
pqr3stu8vwx
|
||||
a1b2c3d4e5f
|
||||
treb7uchet
|
||||
|
7
2023/samples/day01.txt.part2
Normal file
7
2023/samples/day01.txt.part2
Normal file
@ -0,0 +1,7 @@
|
||||
two1nine
|
||||
eightwothree
|
||||
abcone2threexyz
|
||||
xtwone3four
|
||||
4nineeightseven2
|
||||
zoneight234
|
||||
7pqrstsixteen
|
Loading…
Reference in New Issue
Block a user