Skip to content

Commit

Permalink
avoid for both w and b and fix useless rightClickMenu (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
yzyray authored and zsalch committed Oct 12, 2019
1 parent f623fee commit 1dcad70
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
12 changes: 8 additions & 4 deletions src/main/java/featurecat/lizzie/analysis/Leelaz.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 ")
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/featurecat/lizzie/gui/LizzieFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1495,6 +1492,9 @@ public Optional<int[]> convertScreenToCoordinates(int x, int y) {
}

public boolean openRightClickMenu(int x, int y) {
if (Lizzie.leelaz.isKataGo) {
return false;
}
Optional<int[]> boardCoordinates = boardRenderer.convertScreenToCoordinates(x, y);
if (!boardCoordinates.isPresent()) {
return false;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/featurecat/lizzie/gui/LizzieMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,9 @@ public Optional<int[]> convertScreenToCoordinates(int x, int y) {
}

public boolean openRightClickMenu(int x, int y) {
if (Lizzie.leelaz.isKataGo && !Lizzie.frame.isMouseOver) {
return false;
}
Optional<int[]> boardCoordinates = convertScreenToCoordinates(x, y);
if (!boardCoordinates.isPresent()) {
return false;
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/featurecat/lizzie/gui/RightClickMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 1dcad70

Please sign in to comment.