Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiraoka committed Oct 19, 2020
1 parent 33cb711 commit 8bf2209
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/main/java/featurecat/lizzie/analysis/Leelaz.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,8 @@ public Leelaz(String engineCommand) throws JSONException {
// substitute in the weights file
engineCommand = engineCommand.replaceAll("%network-file", config.getString("network-file"));
}
Matcher nicknameMatcher = Pattern.compile("<([^<]*)>\\s*(.*)").matcher(engineCommand);
if (nicknameMatcher.matches()) {
engineNickname = nicknameMatcher.group(1);
engineCommand = nicknameMatcher.group(2);
} else {
engineNickname = null;
}

this.engineCommand = engineCommand;
updateEngineCommandAndNickname(engineCommand);
engineCommand = this.engineCommand;
if (engineCommand.toLowerCase().contains("override-version")) {
this.isKataGo = true;
}
Expand Down Expand Up @@ -955,7 +948,8 @@ public List<String> splitCommand(String commandLine) {
}

public boolean isCommandChange(String command) {
List<String> newList = splitCommand(command);
updateEngineCommandAndNickname(command);
List<String> newList = splitCommand(engineCommand);
if (this.commands.size() != newList.size()) {
engineIndex++;
return true;
Expand All @@ -973,6 +967,17 @@ public boolean isCommandChange(String command) {
}
}

private void updateEngineCommandAndNickname(String command) {
Matcher nicknameMatcher = Pattern.compile("<(.*?)>\\s*(.*)").matcher(command);
if (nicknameMatcher.matches()) {
engineNickname = nicknameMatcher.group(1);
engineCommand = nicknameMatcher.group(2);
} else {
engineNickname = null;
engineCommand = command;
}
}

public boolean isStarted() {
return started;
}
Expand Down

0 comments on commit 8bf2209

Please sign in to comment.