day17: minor code beautifications
This commit is contained in:
parent
c2f01add9f
commit
c4db3e5192
8
day17.py
8
day17.py
@ -25,9 +25,8 @@ class Day(AOCDay):
|
||||
test_solutions_p2 = [112, 968]
|
||||
|
||||
def getBoundaries(self) -> (int, int, int, int):
|
||||
_, ranges = self.getInput().split("=", 1)
|
||||
xRange, yRange = ranges.split(", y=")
|
||||
minX, maxX = map(int, xRange.split(".."))
|
||||
_, xRange, yRange = self.getInput().split("=")
|
||||
minX, maxX = map(int, xRange[:-3].split(".."))
|
||||
minY, maxY = map(int, yRange.split(".."))
|
||||
return minX, maxX, minY, maxY
|
||||
|
||||
@ -40,7 +39,6 @@ class Day(AOCDay):
|
||||
hitCounter = 0
|
||||
for x in range(maxX + 1):
|
||||
for y in range(minY, abs(minY)):
|
||||
h, _ = fire(x, y, minX, maxX, minY, maxY)
|
||||
hitCounter += h
|
||||
hitCounter += fire(x, y, minX, maxX, minY, maxY)[0]
|
||||
|
||||
return hitCounter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user