Skip to content

Commit

Permalink
Show dialog for featurecat#756 when engine ended unintentionally
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiraoka committed Sep 26, 2020
1 parent 907ce21 commit 5571603
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/featurecat/lizzie/analysis/Leelaz.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class Leelaz {
private boolean switching = false;
private int currentEngineN = -1;
private ScheduledExecutorService executor;
private boolean isQuittingNormally = false;

// dynamic komi and opponent komi as reported by dynamic-komi version of leelaz
private float dynamicKomi = Float.NaN;
Expand Down Expand Up @@ -136,6 +137,7 @@ public void startEngine() throws IOException {

isLoaded = false;
isKataGo = false;
isQuittingNormally = false;
bestMoves = new ArrayList<>();
Lizzie.board.getData().tryToClearBestMoves();

Expand Down Expand Up @@ -228,6 +230,7 @@ public void restartEngine() throws IOException {
}

public void normalQuit() {
isQuittingNormally = true;
sendCommand("quit");
executor.shutdown();
try {
Expand Down Expand Up @@ -465,6 +468,14 @@ private void read() {
}
// this line will be reached when Leelaz shuts down
System.out.println("Engine process ended.");
if (!isQuittingNormally) {
String message =
String.format(
"Engine process ended unintentionally for some reason.\n\nEngine command: %s",
engineCommand);
JOptionPane.showMessageDialog(
Lizzie.frame, message, "Lizzie - Error!", JOptionPane.ERROR_MESSAGE);
}

shutdown();
// Do no exit for switching weights
Expand Down

0 comments on commit 5571603

Please sign in to comment.