Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accelerate loading of large SGF #758

Merged
merged 1 commit into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -58,6 +58,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 @@ -559,6 +562,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 @@ -646,6 +652,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