diff --git a/Benchmark/Craftimizer.Benchmark.csproj b/Benchmark/Craftimizer.Benchmark.csproj
index dde07aa..3012dd1 100644
--- a/Benchmark/Craftimizer.Benchmark.csproj
+++ b/Benchmark/Craftimizer.Benchmark.csproj
@@ -6,7 +6,7 @@
enable
enable
x64
- Debug;Release;Trace
+ Debug;Release
@@ -32,10 +32,5 @@
$(DefineConstants);IS_DETERMINISTIC
-
-
- True
- $(DefineConstants);IS_DETERMINISTIC;IS_TRACE
-
diff --git a/Benchmark/Program.cs b/Benchmark/Program.cs
index 1fea691..70c6299 100644
--- a/Benchmark/Program.cs
+++ b/Benchmark/Program.cs
@@ -8,12 +8,8 @@ internal static class Program
{
private static Task Main(string[] args)
{
-#if !IS_TRACE
RunBench(args);
return Task.CompletedTask;
-#else
- return RunTrace();
-#endif
// return RunOther();
}
diff --git a/Craftimizer.Test/Craftimizer.Test.csproj b/Craftimizer.Test/Craftimizer.Test.csproj
index 5c59fdb..f206b95 100644
--- a/Craftimizer.Test/Craftimizer.Test.csproj
+++ b/Craftimizer.Test/Craftimizer.Test.csproj
@@ -4,11 +4,10 @@
net7.0
enable
enable
-
false
true
x64
- Debug;Release;Trace
+ Debug;Release
@@ -27,9 +26,4 @@
$(DefineConstants);IS_DETERMINISTIC
-
- True
- $(DefineConstants);IS_DETERMINISTIC;IS_TRACE
-
-
diff --git a/Craftimizer.Test/Solver/ActionSet.cs b/Craftimizer.Test/Solver/ActionSet.cs
index d34e387..0f4c9df 100644
--- a/Craftimizer.Test/Solver/ActionSet.cs
+++ b/Craftimizer.Test/Solver/ActionSet.cs
@@ -89,31 +89,18 @@ public void TestElementAt()
Assert.AreEqual(4, set.Count);
-#if !IS_TRACE
Assert.AreEqual(ActionType.DelicateSynthesis, set.ElementAt(0));
Assert.AreEqual(ActionType.FocusedTouch, set.ElementAt(1));
Assert.AreEqual(ActionType.ByregotsBlessing, set.ElementAt(2));
Assert.AreEqual(ActionType.BasicSynthesis, set.ElementAt(3));
-#else
- Assert.AreEqual(ActionType.BasicSynthesis, set.ElementAt(0));
- Assert.AreEqual(ActionType.ByregotsBlessing, set.ElementAt(1));
- Assert.AreEqual(ActionType.FocusedTouch, set.ElementAt(2));
- Assert.AreEqual(ActionType.DelicateSynthesis, set.ElementAt(3));
-#endif
set.RemoveAction(ActionType.FocusedTouch);
Assert.AreEqual(3, set.Count);
-#if !IS_TRACE
Assert.AreEqual(ActionType.DelicateSynthesis, set.ElementAt(0));
Assert.AreEqual(ActionType.ByregotsBlessing, set.ElementAt(1));
Assert.AreEqual(ActionType.BasicSynthesis, set.ElementAt(2));
-#else
- Assert.AreEqual(ActionType.BasicSynthesis, set.ElementAt(0));
- Assert.AreEqual(ActionType.ByregotsBlessing, set.ElementAt(1));
- Assert.AreEqual(ActionType.DelicateSynthesis, set.ElementAt(2));
-#endif
}
[TestMethod]
diff --git a/Craftimizer.sln b/Craftimizer.sln
index 3f01805..1aefbd7 100644
--- a/Craftimizer.sln
+++ b/Craftimizer.sln
@@ -23,38 +23,28 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
- Trace|x64 = Trace|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.ActiveCfg = Debug|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.Build.0 = Debug|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.ActiveCfg = Release|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.Build.0 = Release|x64
- {13C812E9-0D42-4B95-8646-40EEBF30636F}.Trace|x64.ActiveCfg = Release|x64
{057C4B64-4D99-4847-9BCF-966571CAE57C}.Debug|x64.ActiveCfg = Debug|x64
{057C4B64-4D99-4847-9BCF-966571CAE57C}.Debug|x64.Build.0 = Debug|x64
{057C4B64-4D99-4847-9BCF-966571CAE57C}.Release|x64.ActiveCfg = Release|x64
{057C4B64-4D99-4847-9BCF-966571CAE57C}.Release|x64.Build.0 = Release|x64
- {057C4B64-4D99-4847-9BCF-966571CAE57C}.Trace|x64.ActiveCfg = Trace|x64
- {057C4B64-4D99-4847-9BCF-966571CAE57C}.Trace|x64.Build.0 = Trace|x64
{172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Debug|x64.ActiveCfg = Debug|x64
{172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Debug|x64.Build.0 = Debug|x64
{172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Release|x64.ActiveCfg = Release|x64
{172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Release|x64.Build.0 = Release|x64
- {172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Trace|x64.ActiveCfg = Trace|x64
- {172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Trace|x64.Build.0 = Trace|x64
{2B0EA452-6DFC-48DB-9049-EA782E600C21}.Debug|x64.ActiveCfg = Debug|x64
{2B0EA452-6DFC-48DB-9049-EA782E600C21}.Debug|x64.Build.0 = Debug|x64
{2B0EA452-6DFC-48DB-9049-EA782E600C21}.Release|x64.ActiveCfg = Release|x64
{2B0EA452-6DFC-48DB-9049-EA782E600C21}.Release|x64.Build.0 = Release|x64
- {2B0EA452-6DFC-48DB-9049-EA782E600C21}.Trace|x64.ActiveCfg = Trace|x64
- {2B0EA452-6DFC-48DB-9049-EA782E600C21}.Trace|x64.Build.0 = Trace|x64
{C3AEA981-9DA8-405C-995B-86528493891B}.Debug|x64.ActiveCfg = Debug|x64
{C3AEA981-9DA8-405C-995B-86528493891B}.Debug|x64.Build.0 = Debug|x64
{C3AEA981-9DA8-405C-995B-86528493891B}.Release|x64.ActiveCfg = Release|x64
{C3AEA981-9DA8-405C-995B-86528493891B}.Release|x64.Build.0 = Release|x64
- {C3AEA981-9DA8-405C-995B-86528493891B}.Trace|x64.ActiveCfg = Trace|x64
- {C3AEA981-9DA8-405C-995B-86528493891B}.Trace|x64.Build.0 = Trace|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Simulator/Craftimizer.Simulator.csproj b/Simulator/Craftimizer.Simulator.csproj
index 908f912..7ade191 100644
--- a/Simulator/Craftimizer.Simulator.csproj
+++ b/Simulator/Craftimizer.Simulator.csproj
@@ -5,7 +5,7 @@
enable
enable
x64
- Debug;Release;Trace
+ Debug;Release
@@ -19,9 +19,4 @@
$(DefineConstants);IS_DETERMINISTIC
-
- True
- $(DefineConstants);IS_DETERMINISTIC;IS_TRACE
-
-
diff --git a/Solver/ActionSet.cs b/Solver/ActionSet.cs
index 9d73151..24b135d 100644
--- a/Solver/ActionSet.cs
+++ b/Solver/ActionSet.cs
@@ -11,7 +11,6 @@ public struct ActionSet
public static readonly ActionType[] AcceptedActions = new[]
{
-#if !IS_TRACE
ActionType.StandardTouchCombo,
ActionType.AdvancedTouchCombo,
ActionType.FocusedTouchCombo,
@@ -41,36 +40,6 @@ public struct ActionSet
ActionType.Observe,
ActionType.MastersMend,
ActionType.BasicTouch,
-#else
- //ActionType.BasicSynthesis,
- ActionType.BasicTouch,
- ActionType.MastersMend,
- ActionType.Observe,
- ActionType.WasteNot,
- ActionType.Veneration,
- ActionType.StandardTouch,
- ActionType.GreatStrides,
- ActionType.Innovation,
- ActionType.BasicSynthesis,
- ActionType.WasteNot2,
- ActionType.ByregotsBlessing,
- ActionType.MuscleMemory,
- //ActionType.CarefulSynthesis,
- ActionType.Manipulation,
- ActionType.PrudentTouch,
- ActionType.FocusedSynthesis,
- ActionType.FocusedTouch,
- ActionType.Reflect,
- ActionType.PreparatoryTouch,
- //ActionType.Groundwork,
- ActionType.DelicateSynthesis,
- ActionType.TrainedEye,
- ActionType.CarefulSynthesis,
- ActionType.AdvancedTouch,
- ActionType.Groundwork,
- ActionType.PrudentSynthesis,
- ActionType.TrainedFinesse,
-#endif
};
public static readonly int[] AcceptedActionsLUT;
diff --git a/Solver/Craftimizer.Solver.csproj b/Solver/Craftimizer.Solver.csproj
index 9be317b..35e7190 100644
--- a/Solver/Craftimizer.Solver.csproj
+++ b/Solver/Craftimizer.Solver.csproj
@@ -6,7 +6,7 @@
enable
True
x64
- Debug;Release;Trace
+ Debug;Release
@@ -24,9 +24,4 @@
$(DefineConstants);IS_DETERMINISTIC
-
- True
- $(DefineConstants);IS_DETERMINISTIC;IS_TRACE
-
-
diff --git a/Solver/SimulationNode.cs b/Solver/SimulationNode.cs
index 0b67f9f..a0c722b 100644
--- a/Solver/SimulationNode.cs
+++ b/Solver/SimulationNode.cs
@@ -1,5 +1,7 @@
using Craftimizer.Simulator;
using Craftimizer.Simulator.Actions;
+using System.Diagnostics.Contracts;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Craftimizer.Solver;
@@ -40,9 +42,11 @@ public static CompletionState GetCompletionState(CompletionState simCompletionSt
if (state.Input.Recipe.MaxQuality == 0)
return 1f - ((float)(state.ActionCount + 1) / config.MaxStepCount);
-
+
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
static float Apply(float bonus, float value, float target) =>
- bonus * (target > 0 ? Math.Min(1f, value / target) : 1);
+ bonus * (target > 0 ? Math.Clamp(value / target, 0, 1) : 1);
var progressScore = Apply(
config.ScoreProgress,
diff --git a/Solver/Trace.cs b/Solver/Trace.cs
deleted file mode 100644
index 36cdc02..0000000
--- a/Solver/Trace.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-
-namespace Craftimizer.Solver;
-
-internal static class Trace
-{
- [Conditional("IS_TRACE")]
- [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
- public static void Log(string msg) =>
- Console.WriteLine(msg);
-}