From 9cd6bafd89ac07f65a471070a14d53999270e7ad Mon Sep 17 00:00:00 2001 From: Hiraoka Date: Sat, 10 Oct 2020 20:03:11 +0900 Subject: [PATCH] Disable "Avoid Keep Variations" if it is 0 (ref. #772) --- src/main/java/featurecat/lizzie/Config.java | 4 ++++ src/main/java/featurecat/lizzie/analysis/Leelaz.java | 5 ++++- src/main/java/featurecat/lizzie/gui/LizzieFrame.java | 3 +++ src/main/java/featurecat/lizzie/gui/LizzieMain.java | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/featurecat/lizzie/Config.java b/src/main/java/featurecat/lizzie/Config.java index be35f4043..d92b090d4 100644 --- a/src/main/java/featurecat/lizzie/Config.java +++ b/src/main/java/featurecat/lizzie/Config.java @@ -449,6 +449,10 @@ public boolean showBranchNow() { return showBranch || showBestMovesTemporarily; } + public boolean useAvoidInAnalysis() { + return config.getJSONObject("leelaz").getInt("avoid-keep-variations") > 0; + } + /** * Scans the current directory as well as the current PATH to find a reasonable default leelaz * binary. diff --git a/src/main/java/featurecat/lizzie/analysis/Leelaz.java b/src/main/java/featurecat/lizzie/analysis/Leelaz.java index 0a6fb9fea..8e178eb7e 100644 --- a/src/main/java/featurecat/lizzie/analysis/Leelaz.java +++ b/src/main/java/featurecat/lizzie/analysis/Leelaz.java @@ -726,7 +726,10 @@ public void analyzeAvoid(String parameters) { public void ponder() { isPondering = true; startPonderTime = System.currentTimeMillis(); - if (Lizzie.board.isAvoding && Lizzie.board.isKeepingAvoid && !isKataGo) + if (Lizzie.board.isAvoding + && Lizzie.board.isKeepingAvoid + && !isKataGo + && Lizzie.config.useAvoidInAnalysis()) analyzeAvoid( "avoid b " + Lizzie.board.avoidCoords diff --git a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java index 434828245..13844099f 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java @@ -1521,6 +1521,9 @@ public boolean openRightClickMenu(int x, int y) { if (isPlayingAgainstLeelaz) { return false; } + if (!Lizzie.config.useAvoidInAnalysis()) { + return false; + } if (Lizzie.leelaz.isPondering()) { Lizzie.leelaz.sendCommand("name"); } diff --git a/src/main/java/featurecat/lizzie/gui/LizzieMain.java b/src/main/java/featurecat/lizzie/gui/LizzieMain.java index a533dac36..17e06cbd2 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieMain.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieMain.java @@ -738,6 +738,9 @@ public boolean openRightClickMenu(int x, int y) { if (isPlayingAgainstLeelaz) { return false; } + if (!Lizzie.config.useAvoidInAnalysis()) { + return false; + } if (Lizzie.leelaz.isPondering()) { Lizzie.leelaz.sendCommand("name"); }