diff --git a/src/FactorioTools/OilField/Algorithms/DijkstrasResult.cs b/src/FactorioTools/OilField/Algorithms/DijkstrasResult.cs index eec7474d..c6c65d86 100644 --- a/src/FactorioTools/OilField/Algorithms/DijkstrasResult.cs +++ b/src/FactorioTools/OilField/Algorithms/DijkstrasResult.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Knapcode.FactorioTools.Data; @@ -7,11 +6,8 @@ namespace Knapcode.FactorioTools.OilField; public class DijkstrasResult { - private readonly SquareGrid _grid; - public DijkstrasResult(SquareGrid grid, Dictionary locationToPrevious, LocationSet reachedGoals) { - _grid = grid; LocationToPrevious = locationToPrevious; ReachedGoals = reachedGoals; } @@ -39,7 +35,13 @@ public List> GetStraightPaths(Location goal) // Track the number of times each direction was used so when we have to switch directions, we can prefer a // direction that's been used the most. - var directionHits = Enum.GetValues().ToDictionary(x => x, x => 0); + var directionHits = new Dictionary + { + { Direction.Up, 0 }, + { Direction.Right, 0 }, + { Direction.Down, 0 }, + { Direction.Left, 0 }, + }; var current = goal; var path = new List(); diff --git a/src/FactorioTools/OilField/OilFieldOptions.cs b/src/FactorioTools/OilField/OilFieldOptions.cs index 1fdf1a36..cf9661bf 100644 --- a/src/FactorioTools/OilField/OilFieldOptions.cs +++ b/src/FactorioTools/OilField/OilFieldOptions.cs @@ -87,24 +87,28 @@ public static OilFieldOptions ForSubstation } } - public static IReadOnlyList AllPipeStrategies { get; } = Enum - .GetValues() - .Order() - .ToList(); + public static IReadOnlyList AllPipeStrategies { get; } = new[] + { + PipeStrategy.FbeOriginal, + PipeStrategy.Fbe, + PipeStrategy.ConnectedCentersDelaunay, + PipeStrategy.ConnectedCentersDelaunayMst, + PipeStrategy.ConnectedCentersFlute, + }; - public static IReadOnlyList DefaultPipeStrategies { get; } = Enum - .GetValues() + public static IReadOnlyList DefaultPipeStrategies { get; } = AllPipeStrategies .Except(new[] { PipeStrategy.FbeOriginal }) .Order() .ToList(); - public static IReadOnlyList AllBeaconStrategies { get; } = Enum - .GetValues() - .Order() - .ToList(); + public static IReadOnlyList AllBeaconStrategies { get; } = new[] + { + BeaconStrategy.FbeOriginal, + BeaconStrategy.Fbe, + BeaconStrategy.Snug, + }; - public static IReadOnlyList DefaultBeaconStrategies { get; } = Enum - .GetValues() + public static IReadOnlyList DefaultBeaconStrategies { get; } = AllBeaconStrategies .Except(new[] { BeaconStrategy.FbeOriginal }) .Order() .ToList(); diff --git a/test/FactorioTools.Test/OilField/OilFieldOptionsTest.cs b/test/FactorioTools.Test/OilField/OilFieldOptionsTest.cs new file mode 100644 index 00000000..84b0b8ac --- /dev/null +++ b/test/FactorioTools.Test/OilField/OilFieldOptionsTest.cs @@ -0,0 +1,16 @@ +namespace Knapcode.FactorioTools.OilField; + +public class OilFieldOptionsTest +{ + [Fact] + public void AllPipeStrategies() + { + Assert.Equal(Enum.GetValues(), OilFieldOptions.AllPipeStrategies); + } + + [Fact] + public void AllBeaconStrategies() + { + Assert.Equal(Enum.GetValues(), OilFieldOptions.AllBeaconStrategies); + } +}