From 1dcad702d105d7f75b36440df0c900ccf0e74716 Mon Sep 17 00:00:00 2001 From: yzyray <49384584+yzyray@users.noreply.github.com> Date: Sat, 12 Oct 2019 14:13:23 +0800 Subject: [PATCH] avoid for both w and b and fix useless rightClickMenu (#623) --- src/main/java/featurecat/lizzie/analysis/Leelaz.java | 12 ++++++++---- src/main/java/featurecat/lizzie/gui/LizzieFrame.java | 8 ++++---- src/main/java/featurecat/lizzie/gui/LizzieMain.java | 3 +++ .../java/featurecat/lizzie/gui/RightClickMenu.java | 12 ++++++++---- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/main/java/featurecat/lizzie/analysis/Leelaz.java b/src/main/java/featurecat/lizzie/analysis/Leelaz.java index 1e4e02562..194f73cfd 100644 --- a/src/main/java/featurecat/lizzie/analysis/Leelaz.java +++ b/src/main/java/featurecat/lizzie/analysis/Leelaz.java @@ -658,10 +658,14 @@ public void ponder() { startPonderTime = System.currentTimeMillis(); if (Lizzie.board.isAvoding && Lizzie.board.isKeepingAvoid && !isKataGo) analyzeAvoid( - "avoid", - Lizzie.board.getHistory().isBlacksTurn() ? "w" : "b", - Lizzie.board.avoidCoords, - +Lizzie.config.config.getJSONObject("leelaz").getInt("avoid-keep-variations")); + "avoid b " + + Lizzie.board.avoidCoords + + " " + + Lizzie.config.config.getJSONObject("leelaz").getInt("avoid-keep-variations") + + " avoid w " + + Lizzie.board.avoidCoords + + " " + + Lizzie.config.config.getJSONObject("leelaz").getInt("avoid-keep-variations")); else sendCommand( (this.isKataGo ? "kata-analyze " : "lz-analyze ") diff --git a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java index 6831db38a..bda3081e9 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java @@ -1070,10 +1070,7 @@ private void drawCaptured(Graphics2D g, int posX, int posY, int width, int heigh int strokeRadius = 3; g.setStroke(new BasicStroke(strokeRadius == 1 ? strokeRadius : 2 * strokeRadius)); g.drawLine( - posX + strokeRadius, - posY + strokeRadius, - posX - strokeRadius + width, - posY + strokeRadius); + posX + strokeRadius, posY + strokeRadius, posX - strokeRadius + width, posY + strokeRadius); g.drawLine( posX + strokeRadius, posY + 3 * strokeRadius, @@ -1495,6 +1492,9 @@ public Optional convertScreenToCoordinates(int x, int y) { } public boolean openRightClickMenu(int x, int y) { + if (Lizzie.leelaz.isKataGo) { + return false; + } Optional boardCoordinates = boardRenderer.convertScreenToCoordinates(x, y); if (!boardCoordinates.isPresent()) { return false; diff --git a/src/main/java/featurecat/lizzie/gui/LizzieMain.java b/src/main/java/featurecat/lizzie/gui/LizzieMain.java index 6c9552d1d..6370beb8a 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieMain.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieMain.java @@ -711,6 +711,9 @@ public Optional convertScreenToCoordinates(int x, int y) { } public boolean openRightClickMenu(int x, int y) { + if (Lizzie.leelaz.isKataGo && !Lizzie.frame.isMouseOver) { + return false; + } Optional boardCoordinates = convertScreenToCoordinates(x, y); if (!boardCoordinates.isPresent()) { return false; diff --git a/src/main/java/featurecat/lizzie/gui/RightClickMenu.java b/src/main/java/featurecat/lizzie/gui/RightClickMenu.java index 22edd7a78..ef901216b 100644 --- a/src/main/java/featurecat/lizzie/gui/RightClickMenu.java +++ b/src/main/java/featurecat/lizzie/gui/RightClickMenu.java @@ -164,10 +164,14 @@ public void avoid() { Lizzie.board.isAvoding = true; Lizzie.board.isAllowing = false; Lizzie.leelaz.analyzeAvoid( - "avoid", - Lizzie.board.getHistory().isBlacksTurn() ? "b" : "w", - Lizzie.board.avoidCoords, - Lizzie.config.config.getJSONObject("leelaz").getInt("avoid-keep-variations")); + "avoid b " + + Lizzie.board.avoidCoords + + " " + + Lizzie.config.config.getJSONObject("leelaz").getInt("avoid-keep-variations") + + " avoid w " + + Lizzie.board.avoidCoords + + " " + + Lizzie.config.config.getJSONObject("leelaz").getInt("avoid-keep-variations")); Lizzie.board.getHistory().getData().tryToClearBestMoves(); }