Refactor Day07 to rename variables and fix return type for timeline count methods
This commit is contained in:
+6
-6
@@ -29,15 +29,15 @@ public class Day07 : IPuzzleSolver<long>
|
||||
{
|
||||
var grid = ParsePuzzleInput(pathToPuzzleInput);
|
||||
var start = GetStart(grid);
|
||||
var nodesWithCount = GetTimelinesCountRecursive(grid, start, []);
|
||||
return nodesWithCount;
|
||||
var timelinesCount = GetTimelinesCountRecursive(grid, start, []);
|
||||
return timelinesCount;
|
||||
}
|
||||
|
||||
public long SolvePart2Again(string pathToPuzzleInput)
|
||||
{
|
||||
var grid = ParsePuzzleInput(pathToPuzzleInput);
|
||||
var nodesWithCount = GetTimelinesCount(grid);
|
||||
return nodesWithCount.Sum();
|
||||
var timelinesCount = GetTimelinesCount(grid);
|
||||
return timelinesCount;
|
||||
}
|
||||
|
||||
private Coordinate GetStart(string[] grid)
|
||||
@@ -98,7 +98,7 @@ public class Day07 : IPuzzleSolver<long>
|
||||
return res;
|
||||
}
|
||||
|
||||
private long[] GetTimelinesCount(string[] grid)
|
||||
private long GetTimelinesCount(string[] grid)
|
||||
{
|
||||
var numbersGrid = grid
|
||||
.Select(line => line.Select(c => 0L).ToArray())
|
||||
@@ -125,6 +125,6 @@ public class Day07 : IPuzzleSolver<long>
|
||||
}
|
||||
}
|
||||
|
||||
return numbersGrid[^1];
|
||||
return numbersGrid[^1].Sum();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user