Refactor Day03 tree row helper naming

This commit is contained in:
Sebastian Lindemeier committed 2026-12-03 09:58:39 +01:00
1 parent c8c96f57bc
commit 35d9374c17
1 file changed
+2 -2
+2 -2
View File
@@ -25,7 +25,7 @@ public class Day03 : IPuzzleSolver<long>
{ {
return forestGrid return forestGrid
.Select((gridRow, i) => .Select((gridRow, i) =>
GetTopCorners(gridRow) GetTreesInRow(gridRow)
.Combinations(2) .Combinations(2)
.Select(pair => (topCorners: pair, bottomIndex: GetBottomEdgeIndex(i, pair))) .Select(pair => (topCorners: pair, bottomIndex: GetBottomEdgeIndex(i, pair)))
.Where(tuple => IsBottomEdgeInBounds(tuple.bottomIndex, forestGrid.Length)) .Where(tuple => IsBottomEdgeInBounds(tuple.bottomIndex, forestGrid.Length))
@@ -120,7 +120,7 @@ public class Day03 : IPuzzleSolver<long>
return index < forestGridLength; return index < forestGridLength;
} }
private static int[] GetTopCorners(char[] row) private static int[] GetTreesInRow(char[] row)
{ {
return [.. row.Index().Where(elem => elem.Item == '#').Select(elem => elem.Index)]; return [.. row.Index().Where(elem => elem.Item == '#').Select(elem => elem.Index)];
} }