Skip to content

Commit

Permalink
Fix: No suggestion appeared for Leela 0.11.0 with show-bestmoves-by-hold
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiraoka committed Nov 18, 2020
1 parent a323076 commit c540194
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/featurecat/lizzie/analysis/Leelaz.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public class Leelaz {
public static int engineIndex = 0;

public boolean isLeela0110 = false;
private List<MoveData> leela0110BestMoves;
private Timer leela0110PonderingTimer;
private BoardData leela0110PonderingBoardData;
private static final int LEELA0110_PONDERING_INTERVAL_MILLIS = 1000;
Expand Down Expand Up @@ -394,12 +395,13 @@ private void parseLine(String line) {
|| isLeela0110 && isPondering
|| isThinking
&& (!isPondering && Lizzie.frame.isPlayingAgainstLeelaz || isInputCommand)) {
List<MoveData> bm = isLeela0110 ? leela0110BestMoves : bestMoves;
// TODO Do not update the best moves when playing against Leela Zero
// Because it is equivalent to the winrate of the previous move.
if (!Lizzie.frame.isPlayingAgainstLeelaz
&& (Lizzie.config.limitBestMoveNum == 0
|| bestMoves.size() < Lizzie.config.limitBestMoveNum)) {
bestMoves.add(MoveData.fromSummary(line));
|| bm.size() < Lizzie.config.limitBestMoveNum)) {
bm.add(MoveData.fromSummary(line));
if (isLeela0110) return;
notifyBestMoveListeners();
Lizzie.frame.refresh(1);
Expand All @@ -413,7 +415,8 @@ private void parseLine(String line) {
isThinking = false;

} else if (isLeela0110 && line.startsWith("=====")) {
if (isLeela0110PonderingValid()) Lizzie.board.getData().tryToSetBestMoves(bestMoves);
if (isLeela0110PonderingValid())
Lizzie.board.getData().tryToSetBestMoves(bestMoves = leela0110BestMoves);
Lizzie.frame.refresh(1);
Lizzie.frame.updateTitle();
leela0110UpdatePonder();
Expand Down Expand Up @@ -784,7 +787,7 @@ private void leela0110Ponder() {
synchronized (this) {
if (leela0110PonderingBoardData != null) return;
leela0110PonderingBoardData = Lizzie.board.getData();
bestMoves = new ArrayList<>();
leela0110BestMoves = new ArrayList<>();
sendCommand("time_left b 0 0");
leela0110PonderingTimer = new Timer();
leela0110PonderingTimer.schedule(
Expand Down

0 comments on commit c540194

Please sign in to comment.