diff --git a/Craftimizer/Windows/SynthHelper.cs b/Craftimizer/Windows/SynthHelper.cs index 4e09591..470bfa7 100644 --- a/Craftimizer/Windows/SynthHelper.cs +++ b/Craftimizer/Windows/SynthHelper.cs @@ -372,6 +372,7 @@ private void DrawMacroInfo() if (!effect.IsIndefinite()) { ImGui.SetCursorPosY(ImGui.GetCursorPosY() - durationShift); + ImGui.SetCursorPosX(ImGui.GetCursorPosX() + 1); ImGuiUtils.TextCentered($"{effects.GetDuration(effect)}", size.X); } } diff --git a/Solver/MCTS.cs b/Solver/MCTS.cs index 6ff05c3..a26a219 100644 --- a/Solver/MCTS.cs +++ b/Solver/MCTS.cs @@ -191,18 +191,21 @@ private Node Select() var currentCompletionState = expandedNode.State.SimulationCompletionState; var currentActions = expandedNode.State.AvailableActions; - byte actionCount = 0; - var actions = actionBuffer[..Math.Min(config.MaxStepCount - currentState.ActionCount, config.MaxRolloutStepCount)]; - while (SimulationNode.GetCompletionState(currentCompletionState, currentActions) == CompletionState.Incomplete && - actionCount < actions.Length) + if (currentState.ActionCount < config.MaxStepCount) { - var nextAction = currentActions.SelectRandom(random); - actions[actionCount++] = nextAction; - currentState = simulator.ExecuteUnchecked(currentState, nextAction); - currentCompletionState = simulator.CompletionState; - if (currentCompletionState != CompletionState.Incomplete) - break; - currentActions = simulator.AvailableActionsHeuristic(true); + var actions = actionBuffer[..Math.Min(config.MaxStepCount - currentState.ActionCount, config.MaxRolloutStepCount)]; + byte actionCount = 0; + while (SimulationNode.GetCompletionState(currentCompletionState, currentActions) == CompletionState.Incomplete && + actionCount < actions.Length) + { + var nextAction = currentActions.SelectRandom(random); + actions[actionCount++] = nextAction; + currentState = simulator.ExecuteUnchecked(currentState, nextAction); + currentCompletionState = simulator.CompletionState; + if (currentCompletionState != CompletionState.Incomplete) + break; + currentActions = simulator.AvailableActionsHeuristic(true); + } } var score = SimulationNode.CalculateScoreForState(currentState, currentCompletionState, config) ?? 0;