mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
[Simulated AI] Make printing of the decision tree a bit better.
Also removes a print line from a test.
This commit is contained in:
@@ -43,6 +43,7 @@ public class Plan {
|
|||||||
final Score initialScore;
|
final Score initialScore;
|
||||||
|
|
||||||
final String sa;
|
final String sa;
|
||||||
|
final String saHumanStr;
|
||||||
PossibleTargetSelector.Targets targets;
|
PossibleTargetSelector.Targets targets;
|
||||||
String choice;
|
String choice;
|
||||||
int[] modes;
|
int[] modes;
|
||||||
@@ -52,14 +53,16 @@ public class Plan {
|
|||||||
this.initialScore = initialScore;
|
this.initialScore = initialScore;
|
||||||
this.prevDecision = prevDecision;
|
this.prevDecision = prevDecision;
|
||||||
this.sa = sa.toString();
|
this.sa = sa.toString();
|
||||||
|
this.saHumanStr = SpellAbilityPicker.abilityToString(sa);
|
||||||
this.targets = null;
|
this.targets = null;
|
||||||
this.choice = null;
|
this.choice = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Decision(Score initialScore, Decision prevDecision, String saString) {
|
public Decision(Score initialScore, Decision prevDecision, String saString, String saHumanStr) {
|
||||||
this.initialScore = initialScore;
|
this.initialScore = initialScore;
|
||||||
this.prevDecision = prevDecision;
|
this.prevDecision = prevDecision;
|
||||||
this.sa = saString;
|
this.sa = saString;
|
||||||
|
this.saHumanStr = saHumanStr;
|
||||||
this.targets = null;
|
this.targets = null;
|
||||||
this.choice = null;
|
this.choice = null;
|
||||||
}
|
}
|
||||||
@@ -68,6 +71,7 @@ public class Plan {
|
|||||||
this.initialScore = initialScore;
|
this.initialScore = initialScore;
|
||||||
this.prevDecision = prevDecision;
|
this.prevDecision = prevDecision;
|
||||||
this.sa = null;
|
this.sa = null;
|
||||||
|
this.saHumanStr = null;
|
||||||
this.targets = targets;
|
this.targets = targets;
|
||||||
this.choice = null;
|
this.choice = null;
|
||||||
}
|
}
|
||||||
@@ -76,6 +80,7 @@ public class Plan {
|
|||||||
this.initialScore = initialScore;
|
this.initialScore = initialScore;
|
||||||
this.prevDecision = prevDecision;
|
this.prevDecision = prevDecision;
|
||||||
this.sa = null;
|
this.sa = null;
|
||||||
|
this.saHumanStr = null;
|
||||||
this.targets = null;
|
this.targets = null;
|
||||||
this.choice = choice.getName();
|
this.choice = choice.getName();
|
||||||
}
|
}
|
||||||
@@ -84,26 +89,35 @@ public class Plan {
|
|||||||
this.initialScore = initialScore;
|
this.initialScore = initialScore;
|
||||||
this.prevDecision = prevDecision;
|
this.prevDecision = prevDecision;
|
||||||
this.sa = null;
|
this.sa = null;
|
||||||
|
this.saHumanStr = null;
|
||||||
this.targets = null;
|
this.targets = null;
|
||||||
this.choice = null;
|
this.choice = null;
|
||||||
this.modes = modes;
|
this.modes = modes;
|
||||||
this.modesStr = modesStr;
|
this.modesStr = modesStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public String toString(boolean showHostCard) {
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("[initScore=").append(initialScore).append(" ");
|
if (!showHostCard) {
|
||||||
|
sb.append("[initScore=").append(initialScore).append(" ");
|
||||||
|
}
|
||||||
if (modesStr != null) {
|
if (modesStr != null) {
|
||||||
sb.append(modesStr);
|
sb.append(modesStr);
|
||||||
} else {
|
} else {
|
||||||
sb.append(sa);
|
sb.append(showHostCard ? saHumanStr : sa);
|
||||||
}
|
}
|
||||||
if (targets != null) {
|
if (targets != null) {
|
||||||
sb.append(" (targets: ").append(targets).append(")");
|
sb.append(" (targets: ").append(targets).append(")");
|
||||||
}
|
}
|
||||||
sb.append("]");
|
if (!showHostCard) {
|
||||||
|
sb.append("]");
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return toString(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ public class SimulationController {
|
|||||||
d = d.prevDecision;
|
d = d.prevDecision;
|
||||||
}
|
}
|
||||||
|
|
||||||
Plan.Decision merged = new Plan.Decision(d.initialScore, d.prevDecision, d.sa);
|
Plan.Decision merged = new Plan.Decision(d.initialScore, d.prevDecision, d.sa, d.saHumanStr);
|
||||||
merged.targets = targets;
|
merged.targets = targets;
|
||||||
merged.choice = choice;
|
merged.choice = choice;
|
||||||
merged.modes = modes;
|
merged.modes = modes;
|
||||||
@@ -252,7 +252,7 @@ public class SimulationController {
|
|||||||
System.err.print(" ");
|
System.err.print(" ");
|
||||||
String str;
|
String str;
|
||||||
if (useStack && !currentStack.isEmpty()) {
|
if (useStack && !currentStack.isEmpty()) {
|
||||||
str = getLastMergedDecision().toString();
|
str = getLastMergedDecision().toString(true);
|
||||||
} else {
|
} else {
|
||||||
str = SpellAbilityPicker.abilityToString(origSa);
|
str = SpellAbilityPicker.abilityToString(origSa);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,6 +348,8 @@ public class SpellAbilityPicker {
|
|||||||
for (AbilitySub sub : result) {
|
for (AbilitySub sub : result) {
|
||||||
if (sb.length() > 0) {
|
if (sb.length() > 0) {
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
|
} else {
|
||||||
|
sb.append(sub.getHostCard()).append(" -> ");
|
||||||
}
|
}
|
||||||
sb.append(sub);
|
sb.append(sub);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -670,7 +670,6 @@ public class GameSimulatorTest extends TestCase {
|
|||||||
assertEquals(1, scionCopy.getNetPower());
|
assertEquals(1, scionCopy.getNetPower());
|
||||||
assertEquals(1, scionCopy.getNetToughness());
|
assertEquals(1, scionCopy.getNetToughness());
|
||||||
assertTrue(scionCopy.isSick());
|
assertTrue(scionCopy.isSick());
|
||||||
System.err.println("Search continues on: " + scionCopy);
|
|
||||||
assertNotNull(findSAWithPrefix(scionCopy, "Sacrifice CARDNAME: Add {C} to your mana pool."));
|
assertNotNull(findSAWithPrefix(scionCopy, "Sacrifice CARDNAME: Add {C} to your mana pool."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user