Fix out of range exception
This commit is contained in:
@@ -372,6 +372,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
|||||||
if (!effect.IsIndefinite())
|
if (!effect.IsIndefinite())
|
||||||
{
|
{
|
||||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - durationShift);
|
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - durationShift);
|
||||||
|
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + 1);
|
||||||
ImGuiUtils.TextCentered($"{effects.GetDuration(effect)}", size.X);
|
ImGuiUtils.TextCentered($"{effects.GetDuration(effect)}", size.X);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -191,8 +191,10 @@ public sealed class MCTS
|
|||||||
var currentCompletionState = expandedNode.State.SimulationCompletionState;
|
var currentCompletionState = expandedNode.State.SimulationCompletionState;
|
||||||
var currentActions = expandedNode.State.AvailableActions;
|
var currentActions = expandedNode.State.AvailableActions;
|
||||||
|
|
||||||
byte actionCount = 0;
|
if (currentState.ActionCount < config.MaxStepCount)
|
||||||
|
{
|
||||||
var actions = actionBuffer[..Math.Min(config.MaxStepCount - currentState.ActionCount, config.MaxRolloutStepCount)];
|
var actions = actionBuffer[..Math.Min(config.MaxStepCount - currentState.ActionCount, config.MaxRolloutStepCount)];
|
||||||
|
byte actionCount = 0;
|
||||||
while (SimulationNode.GetCompletionState(currentCompletionState, currentActions) == CompletionState.Incomplete &&
|
while (SimulationNode.GetCompletionState(currentCompletionState, currentActions) == CompletionState.Incomplete &&
|
||||||
actionCount < actions.Length)
|
actionCount < actions.Length)
|
||||||
{
|
{
|
||||||
@@ -204,6 +206,7 @@ public sealed class MCTS
|
|||||||
break;
|
break;
|
||||||
currentActions = simulator.AvailableActionsHeuristic(true);
|
currentActions = simulator.AvailableActionsHeuristic(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var score = SimulationNode.CalculateScoreForState(currentState, currentCompletionState, config) ?? 0;
|
var score = SimulationNode.CalculateScoreForState(currentState, currentCompletionState, config) ?? 0;
|
||||||
return (expandedNode, score);
|
return (expandedNode, score);
|
||||||
|
|||||||
Reference in New Issue
Block a user