Skip to content

Fix best move arrow not shown when engine lines set to zero#3100

Merged
veloce merged 1 commit into
lichess-org:mainfrom
MaartenD:fix/best-move-not-showing-with-zero-engine-lines
May 4, 2026
Merged

Fix best move arrow not shown when engine lines set to zero#3100
veloce merged 1 commit into
lichess-org:mainfrom
MaartenD:fix/best-move-not-showing-with-zero-engine-lines

Conversation

@MaartenD

@MaartenD MaartenD commented May 3, 2026

Copy link
Copy Markdown
Contributor

Fix: Best move arrow not shown when engine lines is set to 0

When the "Show best move arrow" option was enabled but the number of engine lines was set to 0, the best move arrow was not displayed on the board.

Root cause
In analysis_board.dart, the best moves were filtered using .take(enginePrefs.numEvalLines). When numEvalLines is 0, .take(0) returns an empty list, so no arrow was drawn. This was inconsistent with the UCI protocol layer in uci_protocol.dart, which already uses math.max(1, multiPv) to ensure Stockfish always evaluates at least one line.

Fix
Changed .take(enginePrefs.numEvalLines) to .take(math.max(1, enginePrefs.numEvalLines)) in analysis_board.dart, so that at least the best move is always passed to computeBestMoveShapes() when the engine is running, regardless of the number of displayed lines.

Test
A new test was added to the Engine best move arrow group in analysis_screen_test.dart, verifying that the best move arrow is displayed even when the number of engine lines is set to 0.

Fixes: #2871

@veloce veloce left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@veloce veloce merged commit c7b3d26 into lichess-org:main May 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Best move" not showing

2 participants