-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Truncate Score Display #300
base: master
Are you sure you want to change the base?
Truncate Score Display #300
Conversation
uses lila's score formatting See: https://github.com/lichess-org/lila/blob/e110605c138c1f6fec417ab9317968b32a928a16/ui/ceval/src/util.ts#L8
Adding a couple things:
|
2ae6122
to
532db9e
Compare
src/utils/tests/score.test.ts
Outdated
}); | ||
|
||
test("should format a large cp score correctly", () => { | ||
expect(formatScore({ type: "cp", value: 12345.67 })).toBe("+99.0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a) centipawn values are only integers
b) while the conversion might be useful for lichess it isn't so much for a local gui, Stockfish displays values up to 20000 for centipawns and we have a nice relation between the distance to zero for tablebase position official-stockfish/Stockfish@def2966 it be unfortunate to lose this information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a) Good point, I'll change that test to use a sensible value. I'm still learning the engine interface stuff as I go
b) Afaik, the truncated values will only be used on the eval bar, which is too narrow to display arbitrarily sized values without overflowing. The exact value of the eval bar is displayed by a tooltip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b) ah okay if it is only the evalbar then it is fine, I had the fear that it might be reused for the engine evaluation display
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just double checked, and there is also some truncation (in my branch, but also upstream) on the summary to the right of the engine component that displays the evaluation of the first variation
The space here is wide enough to use the full value without truncation, I can change it to do that if that's preferred too
to display possible 5 digit cp values without overflowing
precision is more common throughout
@@ -66,22 +66,31 @@ function ScoreBubble({ | |||
textAlign: "center", | |||
padding: "0.15rem", | |||
borderRadius: theme.radius.sm, | |||
width: size === "md" ? "4rem" : "3.5rem", | |||
width: size === "md" ? "5.0rem" : "3.5rem", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these changes from 4rem to 5rem really necessary? I think it would be better to change it to minWidth and keep it at 4rem
uses lila's score formatting
See: https://github.com/lichess-org/lila/blob/e110605c138c1f6fec417ab9317968b32a928a16/ui/ceval/src/util.ts#L8