-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,8 @@ public class Leelaz { | |
private boolean isLoaded = false; | ||
private boolean isCheckingVersion; | ||
|
||
// dynamic komi and opponent komi as reported by dynamic-komi version of leelaz | ||
private float dynamicKomi = Float.NaN, dynamicOppKomi = Float.NaN; | ||
/** | ||
* Initializes the leelaz process and starts reading output | ||
* | ||
|
@@ -180,7 +182,25 @@ private void parseInfo(String line) { | |
*/ | ||
private void parseLine(String line) { | ||
synchronized (this) { | ||
if (line.equals("\n")) { | ||
if (line.startsWith("komi=")) | ||
{ | ||
try { | ||
dynamicKomi = Float.parseFloat(line.substring("komi=".length()).trim()); | ||
} | ||
catch (NumberFormatException nfe) { | ||
dynamicKomi = Float.NaN; | ||
} | ||
} | ||
else if (line.startsWith("opp_komi=")) | ||
{ | ||
try { | ||
dynamicOppKomi = Float.parseFloat(line.substring("opp_komi=".length()).trim()); | ||
} | ||
catch (NumberFormatException nfe) { | ||
dynamicOppKomi = Float.NaN; | ||
} | ||
} | ||
else if (line.equals("\n")) { | ||
// End of response | ||
} else if (line.startsWith("info")) { | ||
isLoaded = true; | ||
|
@@ -425,6 +445,13 @@ public List<MoveData> getBestMoves() { | |
} | ||
} | ||
|
||
public String getDynamicKomi() { | ||
if (Float.isNaN(dynamicKomi) || Float.isNaN(dynamicOppKomi)) { | ||
return null; | ||
} | ||
return String.format("%.1f / %.1f", dynamicKomi, dynamicOppKomi); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
featurecat
Owner
|
||
} | ||
|
||
public boolean isPondering() { | ||
return isPondering; | ||
} | ||
|
hmm I think you misunderstood me although I think the variable names are good. I wanted the output to be labeled haha. So that the user knows what 7.5 / 7.5 means. The variable labeling is good though :)