Split solver into MCTS and algorithms
This commit is contained in:
@@ -6,5 +6,7 @@ public enum CompletionState : byte
|
||||
ProgressComplete,
|
||||
NoMoreDurability,
|
||||
|
||||
Other
|
||||
InvalidAction,
|
||||
MaxActionCountReached,
|
||||
NoMoreActions
|
||||
}
|
||||
|
||||
+11
-11
@@ -21,8 +21,17 @@ public class Simulator
|
||||
|
||||
public bool IsFirstStep => State.StepCount == 0;
|
||||
|
||||
public CompletionState CompletionState => CalculateCompletionState(State);
|
||||
public virtual bool IsComplete => CompletionState != CompletionState.Incomplete;
|
||||
public virtual CompletionState CompletionState {
|
||||
get
|
||||
{
|
||||
if (Progress >= Input.Recipe.MaxProgress)
|
||||
return CompletionState.ProgressComplete;
|
||||
if (Durability <= 0)
|
||||
return CompletionState.NoMoreDurability;
|
||||
return CompletionState.Incomplete;
|
||||
}
|
||||
}
|
||||
public bool IsComplete => CompletionState != CompletionState.Incomplete;
|
||||
|
||||
public IEnumerable<ActionType> AvailableActions => ActionUtils.AvailableActions(this);
|
||||
|
||||
@@ -278,13 +287,4 @@ public class Simulator
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void IncreaseQuality(float efficiency) =>
|
||||
IncreaseQualityRaw(CalculateQualityGain(efficiency, false));
|
||||
|
||||
public static CompletionState CalculateCompletionState(SimulationState state)
|
||||
{
|
||||
if (state.Progress >= state.Input.Recipe.MaxProgress)
|
||||
return CompletionState.ProgressComplete;
|
||||
if (state.Durability <= 0)
|
||||
return CompletionState.NoMoreDurability;
|
||||
return CompletionState.Incomplete;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user