Merge pull request #2238 from tool4ever/simfix

Simulation: Fix including unjustified decisions
This commit is contained in:
Anthony Calosa
2023-01-14 07:43:46 +08:00
committed by GitHub
2 changed files with 4 additions and 3 deletions

View File

@@ -81,9 +81,11 @@ public class SimulationController {
} }
public void doneEvaluating(Score score) { public void doneEvaluating(Score score) {
if (score.value > bestScore.value) { // if we're here during a deeper level this hasn't been called for the level above yet
// in such case we need to check that this decision has really lead to the improvement in score
if (getLastDecision().initialScore.value < score.value && score.value > bestScore.value) {
bestScore = score; bestScore = score;
bestSequence = currentStack.get(currentStack.size() - 1); bestSequence = getLastDecision();
} }
currentStack.remove(currentStack.size() - 1); currentStack.remove(currentStack.size() - 1);
} }

View File

@@ -254,7 +254,6 @@ public class Cost implements Serializable {
else else
manaParts.append(part).append(" "); manaParts.append(part).append(" ");
} }
} }
if (parsedMana == null && (manaParts.length() > 0 || xCantBe0)) { if (parsedMana == null && (manaParts.length() > 0 || xCantBe0)) {