Fixed parsing score and after score

This commit is contained in:
Kai S. K. Engelbart 2019-08-01 19:01:17 +02:00
parent e72297bebf
commit 36597ac6f1

View File

@ -30,29 +30,51 @@ public class UCIInfo {
switch (tokens[i]) { switch (tokens[i]) {
// Single parameter info // Single parameter info
case "depth": case "depth":
case "seldepth": depth = Integer.parseInt(tokens[++i]);
case "time":
case "nodes":
case "multipv":
case "currmove":
case "currmovenumber":
case "hashfull":
case "nps":
case "tbhits":
case "sbhits":
case "cpuload":
case "string":
try {
getClass().getField(tokens[i]).set(this, tokens[++i]);
} catch (Exception ex) {}
break; break;
case "seldepth":
seldepth = Integer.parseInt(tokens[++i]);
break;
case "time":
time = Integer.parseInt(tokens[++i]);
break;
case "nodes":
nodes = Integer.parseInt(tokens[++i]);
break;
case "multipv":
multipv = Integer.parseInt(tokens[++i]);
break;
case "currmove":
currmove = Move.fromSAN(tokens[++i]);
break;
case "currmovenumber":
currmovenumber = Integer.parseInt(tokens[++i]);
break;
case "hashfull":
hashfull = Integer.parseInt(tokens[++i]);
break;
case "nps":
nps = Integer.parseInt(tokens[++i]);
break;
case "tbhits":
tbhits = Integer.parseInt(tokens[++i]);
break;
case "sbhits":
sbhits = Integer.parseInt(tokens[++i]);
break;
case "cpuload":
cpuload = Integer.parseInt(tokens[++i]);
break;
case "string":
displayString = tokens[++i];
break;
case "score":
score = new Score(line.substring(line.indexOf("score") + tokens[i].length() + 1));
i += score.isLowerbound() || score.isUpperbound() ? 1 : 2;
// TODO: pv // TODO: pv
// TODO: refutation // TODO: refutation
// TODO: currline // TODO: currline
case "pv": case "pv":
// TODO: parse infos after score
case "score":
score = new Score(line.substring(tokens[i].length() + 1));
case "refutation": case "refutation":
case "currline": case "currline":
break; break;