Refactor Day08 and Day09 to update collection types and method names for improved consistency and clarity
This commit is contained in:
+3
-3
@@ -54,12 +54,12 @@ public class Day09 : IPuzzleSolver<long>
|
||||
|
||||
private IEnumerable<CoordinatePair> GetAllPossibleRectanglesAsPairs(Coordinate[] redTiles)
|
||||
{
|
||||
return Combinations(redTiles).Select(x => AsMinMax(x.a, x.b));
|
||||
return Combinations(redTiles).Select(x => AsPair(x.a, x.b));
|
||||
}
|
||||
|
||||
private CoordinatePair[] GetBordersAsPairs(Coordinate[] redTiles)
|
||||
{
|
||||
return GetBorders(redTiles).Select(x => AsMinMax(x.a, x.b)).ToArray();
|
||||
return GetBorders(redTiles).Select(x => AsPair(x.a, x.b)).ToArray();
|
||||
}
|
||||
|
||||
private bool IsRectangleInsideBorders(CoordinatePair[] borders, CoordinatePair rectangle)
|
||||
@@ -67,7 +67,7 @@ public class Day09 : IPuzzleSolver<long>
|
||||
return !borders.Any(border => RectangleCrossesBorder(rectangle, border));
|
||||
}
|
||||
|
||||
private CoordinatePair AsMinMax(Coordinate a, Coordinate b)
|
||||
private CoordinatePair AsPair(Coordinate a, Coordinate b)
|
||||
{
|
||||
return (Math.Min(a.x, b.x), Math.Min(a.y, b.y), Math.Max(a.x, b.x), Math.Max(a.y, b.y));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user