diff --git a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java index 8feb26a10..384b45a65 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java @@ -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; diff --git a/src/main/java/featurecat/lizzie/gui/WinrateGraph.java b/src/main/java/featurecat/lizzie/gui/WinrateGraph.java index 62dd0de49..4acc6ba99 100644 --- a/src/main/java/featurecat/lizzie/gui/WinrateGraph.java +++ b/src/main/java/featurecat/lizzie/gui/WinrateGraph.java @@ -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 @@ -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)); } }