Day2 fix - thank you elly

main
login000 2024-12-03 14:37:19 +10:30
parent 0aa8bb80ba
commit 30a1293932
1 changed files with 2 additions and 5 deletions

View File

@ -13,7 +13,6 @@ namespace Advent24
{ {
Int32 currentLevel; Int32 currentLevel;
Int32? previousLevel = null; Int32? previousLevel = null;
Int32? previousPreviousLevel = null;
Int32 differenceInLevels = 0; Int32 differenceInLevels = 0;
Boolean? isIncreasing = null; Boolean? isIncreasing = null;
Boolean reportIsSafe = true; Boolean reportIsSafe = true;
@ -29,8 +28,7 @@ namespace Advent24
if((levelIndexToSkip ?? -1) == currentLevelIndex) if((levelIndexToSkip ?? -1) == currentLevelIndex)
{ {
// assume current element doesn't exist, so the previous // assume current element doesn't exist, so the previous
// element should be the one that was before it // element should remain what it was
previousLevel = previousPreviousLevel;
Console.WriteLine("{0:s} {1:d}", " currentLevelIndex (skipped) = ", currentLevelIndex); Console.WriteLine("{0:s} {1:d}", " currentLevelIndex (skipped) = ", currentLevelIndex);
@ -96,8 +94,7 @@ namespace Advent24
// control reaches this line if report has not been proven unsafe yet // control reaches this line if report has not been proven unsafe yet
// updating previousLevel and previousPreviousLevel in preparation for the next iteration // updating previousLevel in preparation for the next iteration
previousPreviousLevel = previousLevel;
previousLevel = currentLevel; previousLevel = currentLevel;
// incrementing the current-element-number indicator // incrementing the current-element-number indicator