lichess-org / lila

♞ lichess.org: the forever free, adless and open source chess server ♞
https://lichess.org
GNU Affero General Public License v3.0
15.65k stars 2.28k forks source link

Advice on analysis board doesn't respect figurine versus letter preference #12333

Open gregorygauthier opened 1 year ago

gregorygauthier commented 1 year ago

Exact URL where the bug happened https://lichess.org/NVFxVr8l/white#43

Steps to reproduce the bug Enable figurine notation Analyze a game in which the chess engine suggests a piece move.

What did you expect to happen? The suggested move should use figurine notation.

What happened instead? The suggested move uses a letter for the piece.

Operating system and browser version Mac OS Monterey 12.5, Firefox 109.0.1

Screen Shot 2023-02-07 at 5 40 31 PM
ErdoganSeref commented 1 year ago

https://github.com/lichess-org/lila/blob/c2c71cbc7fcba9f7b03f265ef539d7aae879a1df/modules/analyse/src/main/Advice.scala#L14 The method creates the advice. So we'd have to pass a Pref object to the method to adjust s" $move was best.".

But when changing the method signature we have to change the method signature of many other dependent methods.

How can we circumvent this issue?

gregorygauthier commented 1 year ago

https://github.com/lichess-org/lila/blob/c2c71cbc7fcba9f7b03f265ef539d7aae879a1df/modules/analyse/src/main/Advice.scala#L14

The method creates the advice. So we'd have to pass a Pref object to the method to adjust s" $move was best.".

But when changing the method signature we have to change the method signature of many other dependent methods.

How can we circumvent this issue?

Is the issue that the advice text is generated server-side and is not user-specific (so it can't reflect figurine versus letter preference)?

Wonder if we could use some sort of token that is replaced with the user's figurine and language preference in the client.

ErdoganSeref commented 1 year ago

The move is embedded inside text which causes the issue. So user preferences cannot apply there. Instead we have to use the unicode chess symbols.

https://github.com/lichess-org/lila/blob/c2c71cbc7fcba9f7b03f265ef539d7aae879a1df/ui/analyse/src/treeView/columnView.ts#L206-L224

Replacing the move in comment.text would be easier but uglier. But we cannot get the user preferences in Typescript.