Skip to content

Commit d0e69f7

Browse files
committed
[2022/15] make scan row and max coord script args optional (default to those used for the puzzle input)
1 parent e6c1216 commit d0e69f7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
File renamed without changes.

2022/15/script.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def row_coverage(intersections):
6060
if __name__ == '__main__':
6161
inputs = (line.rstrip('\n') for line in open(sys.argv[1]))
6262

63+
6364
pairs = []
6465

6566
for line in inputs:
@@ -74,15 +75,16 @@ def row_coverage(intersections):
7475
start = timer()
7576

7677
beacons = set(b for _, b in pairs)
77-
intersections = scan(int(sys.argv[2]), pairs)
78+
scan_row = int(sys.argv[2]) if len(sys.argv) >= 3 else 2000000
79+
intersections = scan(scan_row, pairs)
7880
covered = row_coverage(intersections)
7981
covered -= beacons
8082

8183
end = timer()
8284

8385
print(f'part 1: {len(covered)} {end-start:.6f} seconds')
8486

85-
max_coord = int(sys.argv[3])
87+
max_coord = int(sys.argv[3]) if len(sys.argv) >= 4 else 4000000
8688

8789
start = timer()
8890

0 commit comments

Comments
 (0)