DroidFish: Don't let a buggy engine play a null move.

This commit is contained in:
Peter Osterlund 2017-09-24 03:38:06 +02:00
parent f1e62c5263
commit 500b16dc8f
2 changed files with 7 additions and 2 deletions

View File

@ -148,8 +148,11 @@ public class Game {
if (m != null) if (m != null)
if (!TextIO.isValid(currPos(), m)) if (!TextIO.isValid(currPos(), m))
m = null; m = null;
if (m == null) if (m == null) {
m = TextIO.stringToMove(currPos(), str); m = TextIO.stringToMove(currPos(), str);
if (!TextIO.isValid(currPos(), m))
m = null;
}
if (m == null) if (m == null)
return new Pair<Boolean,Move>(false, null); return new Pair<Boolean,Move>(false, null);

View File

@ -468,7 +468,9 @@ public class GameTest extends TestCase {
assertEquals(TextIO.UCIstringToMove("b8c6"), hist.second.get(1)); assertEquals(TextIO.UCIstringToMove("b8c6"), hist.second.get(1));
assertEquals(expectedPos, hist.first); assertEquals(expectedPos, hist.first);
game.processString("--"); int varNo = game.tree.addMove("--", "", 0, "", "");
assertEquals(0, varNo);
game.tree.goForward(varNo);
hist = game.getUCIHistory(); hist = game.getUCIHistory();
expectedPos = new Position(game.currPos()); expectedPos = new Position(game.currPos());
assertEquals(0, hist.second.size()); assertEquals(0, hist.second.size());