Browse Source

Using coords instead of value in lowest point determination

day09
Ryan Reed 3 years ago
parent
commit
5d42709ea4
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      puzzles/day09.py

+ 2
- 2
puzzles/day09.py View File

@ -31,13 +31,13 @@ class Heightmap:
elif y != max_y and self.heightmap[y+1][x] <= value: elif y != max_y and self.heightmap[y+1][x] <= value:
continue continue
self.low_point_values.append(value)
self.low_point_values.append((x,y))
def calculate_risk_score(self): def calculate_risk_score(self):
if self.low_point_values is None: if self.low_point_values is None:
self.find_low_points() self.find_low_points()
return sum(value+1 for value in self.low_point_values)
return sum(self.heightmap[coords[1]][coords[0]]+1 for coords in self.low_point_values)
def part1(inputs: List[int]) -> int: def part1(inputs: List[int]) -> int:


Loading…
Cancel
Save