Skip to content

Commit

Permalink
Merge #758
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiraoka committed Sep 28, 2020
2 parents 79f0052 + 7f782ac commit fdc1ff2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/featurecat/lizzie/analysis/Leelaz.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public class Leelaz {
private boolean isPondering;
private long startPonderTime;

// enable temporary detaching for efficiency
public boolean isAttached = true;

// fixed_handicap
public boolean isSettingHandicap = false;

Expand Down Expand Up @@ -601,6 +604,9 @@ public void endModifyingBoard() {
* @param move coordinate of the coordinate
*/
public void playMove(Stone color, String move) {
if (!isAttached) {
return;
}
synchronized (this) {
String colorString;
switch (color) {
Expand Down Expand Up @@ -688,6 +694,9 @@ public void handicap(int num) {
}

public void undo() {
if (!isAttached) {
return;
}
synchronized (this) {
sendCommand("undo");
bestMoves = new ArrayList<>();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/featurecat/lizzie/rules/SGFParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ private static boolean parse(String value) {
Lizzie.leelaz.supportScoremean = false;
}

// Detach engine for avoiding useless "play" and "undo" (#752).
Lizzie.leelaz.isAttached = false;
parseValue(value, null, false);
Lizzie.leelaz.isAttached = true;

return true;
}
Expand Down

0 comments on commit fdc1ff2

Please sign in to comment.