Skip to content

Commit

Permalink
add ability to launch lizzie without an engine if the default engine …
Browse files Browse the repository at this point in the history
…command is empty quotes fix #646
  • Loading branch information
featurecat committed Oct 26, 2019
1 parent 2a4799f commit 3bbde1d
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/main/java/featurecat/lizzie/analysis/Leelaz.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class Leelaz {
*
* @throws IOException
*/
public Leelaz(String engineCommand) throws IOException, JSONException {
public Leelaz(String engineCommand) throws JSONException {
board = new Board();
bestMoves = new ArrayList<>();
bestMovesTemp = new ArrayList<>();
Expand Down Expand Up @@ -521,11 +521,13 @@ private void sendCommandToLeelaz(String command) {
Lizzie.gtpConsole.addCommand(command, cmdNumber);
command = cmdNumber + " " + command;
cmdNumber++;
try {
outputStream.write((command + "\n").getBytes());
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
if (outputStream != null) {
try {
outputStream.write((command + "\n").getBytes());
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}

Expand Down Expand Up @@ -690,7 +692,8 @@ public void togglePonder() {

/** End the process */
public void shutdown() {
process.destroy();
if (process != null)
process.destroy();
}

public List<MoveData> getBestMoves() {
Expand Down Expand Up @@ -901,6 +904,13 @@ public boolean isStarted() {
}

public boolean isLoaded() {
if (engineCommand.isEmpty()) {
// we can use Lizzie even without an engine, if the config defaults to ""
if (!isLoaded) {
Lizzie.frame.refresh();
isLoaded = true;
}
}
return isLoaded;
}

Expand Down

0 comments on commit 3bbde1d

Please sign in to comment.