compute child desc before executeNextEvent as the executeEvent may alter result of choice[0].toString, for example, in the case of revealing cards

master
melvinzhang 2015-04-29 21:24:52 +08:00
parent f765a480c6
commit 7a56763a47
1 changed files with 2 additions and 1 deletions

View File

@ -378,9 +378,10 @@ public class MCTSAI implements MagicAI {
if (curr.size() < choices.size()) {
final int idx = curr.size();
final Object[] choice = choices.get(idx);
final String choiceStr = MCTSGameTree.obj2String(choice[0]);
game.executeNextEvent(choice);
final MCTSGameTree child = new MCTSGameTree(curr, idx, game.getScore());
assert (child.desc = MCTSGameTree.obj2String(choice[0])).equals(child.desc);
assert (child.desc = choiceStr).equals(child.desc);
curr.addChild(child);
path.add(child);
return path;