Skip to content

Commit

Permalink
Merge #728
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiraoka committed Sep 28, 2020
2 parents b590330 + aceff21 commit f18b651
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/featurecat/lizzie/gui/LizzieFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1017,8 +1017,8 @@ private void drawMoveStatistics(Graphics2D g, int posX, int posY, int width, int

if (validWinrate || validLastWinrate) {
int maxBarwidth = (int) (width);
int barWidthB = (int) (blackWR * maxBarwidth / 100);
int barWidthW = (int) (whiteWR * maxBarwidth / 100);
int barWidthB = (int) (Math.max(0, Math.min(blackWR, 100)) * maxBarwidth / 100);
int barWidthW = (int) (Math.max(0, Math.min(whiteWR, 100)) * maxBarwidth / 100);
int barPosY = posY + height / 3;
int barPosxB = (int) (posX);
int barPosxW = barPosxB + barWidthB;
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/featurecat/lizzie/gui/WinrateGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,7 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) {
g.setStroke(previousStroke);
}
if (playouts > 0) {
if (wr < 0) {
wr = 100 - lastWr;
} else if (!node.getData().blackToPlay) {
if (!node.getData().blackToPlay) {
wr = 100 - wr;
}
if (Lizzie.frame.isPlayingAgainstLeelaz
Expand Down Expand Up @@ -341,7 +339,7 @@ private double convertWinrate(double winrate) {
double r = 0.5 + handicap / (2 * maxHandicap);
return Math.max(0, Math.min(r, 1)) * 100;
} else {
return winrate;
return Math.max(0, Math.min(winrate, 100));
}
}

Expand Down

0 comments on commit f18b651

Please sign in to comment.