Skip to content

Commit

Permalink
Print dynamic komi if present
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba97531 committed Jul 19, 2018
1 parent 814cfd3 commit 1279e70
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/main/java/featurecat/lizzie/analysis/Leelaz.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public class Leelaz {
private boolean isLoaded = false;
private boolean isCheckingVersion;

//komi
private String komi, oppKomi;
/**
* Initializes the leelaz process and starts reading output
*
Expand Down Expand Up @@ -180,7 +182,15 @@ private void parseInfo(String line) {
*/
private void parseLine(String line) {
synchronized (this) {
if (line.equals("\n")) {
if (line.startsWith("komi"))
{
komi = line.trim();
}
else if (line.startsWith("opp_komi"))
{
oppKomi = line.trim();
}
else if (line.equals("\n")) {
// End of response
} else if (line.startsWith("info")) {
isLoaded = true;
Expand Down Expand Up @@ -425,6 +435,13 @@ public List<MoveData> getBestMoves() {
}
}

public String getKomi() {
if (komi != null && oppKomi != null) {
return komi.substring(5,9) + " / " + oppKomi.substring(5+4, 9+4);
}
return null;
}

public boolean isPondering() {
return isPondering;
}
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/featurecat/lizzie/gui/LizzieFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ public void paint(Graphics g0) {
int ponderingY = boardY + (int) (maxSize*0.93);
double ponderingSize = .02;

// komi
int komiX = this.getInsets().left;
int komiY = boardY + (int) (maxSize*0.86);
double komiSize = .02;


// loading message
int loadingX = ponderingX;
int loadingY = ponderingY;
Expand Down Expand Up @@ -390,6 +396,10 @@ public void paint(Graphics g0) {
ponderingX, ponderingY, ponderingSize);
}

if (Lizzie.leelaz.getKomi() != null) {
drawPonderingState(g, Lizzie.leelaz.getKomi(), komiX, komiY, komiSize);
}

// Todo: Make board move over when there is no space beside the board
if (Lizzie.config.showWinrate) {
drawWinrateGraphContainer(backgroundG, contx, conty, contw, conth);
Expand Down

0 comments on commit 1279e70

Please sign in to comment.