Skip to content
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

Movelist / Tree View now includes color highlights for inaccuracy/mistake/blunder #237

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

yuzisee
Copy link

@yuzisee yuzisee commented Aug 12, 2023

Component

Movelist / Tree View

Implemented in this Pull Request

Some basic color coding for inaccuracies vs. mistakes vs. blunders.

This pull request defines inaccuracy/mistake/blunder based on #242 (comment)#237 (comment) so that both Stockfish & Lc0 evals can be usable by default in Nibbler for analysis of human games.

Testing

image

@yuzisee yuzisee force-pushed the dev-inaccuracy-mistake-blunder-colors branch 3 times, most recently from 29ddcc8 to ba64003 Compare August 12, 2023 20:25
@yuzisee
Copy link
Author

yuzisee commented Aug 13, 2023

FYI I've tested this out quite a bit locally, and stomped out most of the bugs. Let me know if you have any other questions!

@yuzisee yuzisee changed the title Color highlights for inaccuracy/mistake/blunder inside the movelist / tree view Movelist / Tree View now includes color highlights for inaccuracy/mistake/blunder Aug 13, 2023
@OverLordGoldDragon
Copy link
Contributor

Thanks for your work on this! I've read in #235 that it already works for you - so is it good to go to simply clone your branch and follow the install instructions (Windows 11)? And it supports Stockfish, correct?

@yuzisee
Copy link
Author

yuzisee commented Aug 20, 2023

so is it good to go to simply clone your branch and follow the install instructions

Yes.

And it supports Stockfish, correct?

I didn't touch anything Leela/Stockfish specific, so hopefully it does. Give it a try and let us know!

@OverLordGoldDragon
Copy link
Contributor

Works great! Tested Stockfish. -- Few things:

  1. Annotation (underlining) doesn't work directly with Auto-evaluate line, so one must pass through every move (e.g. by holding down arrow key) when importing a PGN to analyze
  2. Can it be made to annotate only my side (White/Black)? I'm rarely interested in opponent's blunders

@yuzisee
Copy link
Author

yuzisee commented Aug 21, 2023

Works great! Tested Stockfish. -- Few things:

  1. Annotation (underlining) doesn't work directly with Auto-evaluate line, so one must pass through every move (e.g. by holding down arrow key) when importing a PGN to analyze

Would you mind sharing the PGN file you're seeing issues with? I can take a look and see what's happening.

I assume you're using this button
image


For reference:

Auto-eval is working for me, here's a screenshot run using https://www.dropbox.com/scl/fi/qpzh38axktnof6e3clup3/nibbler-2.4.dev-windows.zip?rlkey=wzd7i1fajocd54lx1mtehd0ro

image

This is the PGN file from the screenshot
xQc_vs_Franks-is-heres_2023.08.08.pgn.txt

  1. Can it be made to annotate only my side (White/Black)? I'm rarely interested in opponent's blunders

I have some ideas about how to do this, but for now let's focus on making sure auto-eval is working for you. We can revisit the one-side visualizations later.

@OverLordGoldDragon
Copy link
Contributor

@yuzisee
Copy link
Author

yuzisee commented Aug 21, 2023

For some reason the PGN you attached is different than the one in your screenshot
image
but I'm definitely getting underlines.

What settings are you using here:
image
and here
image

@yuzisee
Copy link
Author

yuzisee commented Aug 21, 2023

@OverLordGoldDragon

Would you mind testing to see if it will work, in the meantime, by enabling Q here
image

If that works, I can try updating the code so it doesn't require that setting and always highlights/underlines.

@OverLordGoldDragon
Copy link
Contributor

OverLordGoldDragon commented Aug 21, 2023

Sorry -- correct PGN

I changed all settings to yours and now it works - the one at which it worked is 1M -> 10M nodes (it was also the last thing that didn't match yours, all else failed), so maybe because it's too fast (I set to 16 cores and my CPU is very vast, it passes several moves per second). Also,

  1. Forget all analysis doesn't clear the annotations, I restart Nibbler each time

(Side question: any docs on Nibbler? I can't tell what many of the options do)

@yuzisee
Copy link
Author

yuzisee commented Aug 25, 2023

Forget all analysis doesn't clear the annotations, I restart Nibbler each time

Oh, thanks for catching that! I probably need to add a line or two to

function __clean_tree(node) {

Let me take a look at that.

(Side question: any docs on Nibbler? I can't tell what many of the options do)

Not sure, but @rooklift I'm happy to either start some docs or refresh anything that might already exist. Happy to contribute some cleanup here and there or expand any existing documentation if helpful.

@OverLordGoldDragon in the meantime, if there are any specific options you'd like to learn more about I can probably read the source code and give you an answer 🙂

@OverLordGoldDragon
Copy link
Contributor

Well in our "quest" to mimic Lichess I think it crucial to replicate the evaluation graph - @ rooklift's given me a pointer but I've not had a chance to dig into it.

I've also noticed @ rooklift's comment on another thread which I think belongs in README - i.e. if using classical engines, ensure MultiPV=1, and set Threads and Hash (from Stockfish forums I hear recommended is <70% of RAM).

yuzisee added a commit to yuzisee/nibbler-dev that referenced this pull request Aug 30, 2023
yuzisee added a commit to yuzisee/nibbler-dev that referenced this pull request Aug 30, 2023
@yuzisee
Copy link
Author

yuzisee commented Sep 19, 2023

Discussion, continuing from #242 (comment) and building on #242 (comment)

  • If we follow the Lichess convention of "blunder" being a 25%+ change in winpct, Lichess is essentially arguing that a blunder is 2.98 centipawns from a drawn position. For Stockfish, a blunder is 1.0 centipawns from a drawn position on move 32.
  • If we follow the Lichess convention of "mistake" being a 10%+ change in winpct, Lichess considers 1.1 centipaws from a drawn position to be a mistake. Stockfish would consider 0.67 centipawns to be a mistake from a drawn position on move 32.
  • If we follow the Lichess convention of "inaccuracy" being a 5%+ change in winpct, any winrate past 95% can no longer produce inaccuracies for your opponent because the winpct can't increase by 5% in a single move without becoming more than 100%. Therefore:
    • An eval of ±1.65 is the point at which Stockfish evals could be considered "virtually the same" according to the Stockfish WDL model.
    • An eval of ±7.99 is the point at which Stockfish evals could be considered "virtually the same" according to Lichess live player data.
formula −7.99 −2.98 −1.65 +1.65 +2.98 +7.99
SF v16 @ move 0 98.8% B : 1.2% W 1.2% B : 98.8% W
SF v16 @ move 32 98.6% B : 1.4% W 1.4% B : 98.6% W
SF v16 @ move ≥120 95% B : 5% W 5% B : 95% W
Lichess 2023 95% B 75% B 64.7% B 64.7% W 75% W 95% W

Conclusion

The suggestions in #242 (comment) were to use 0.25 & 0.5, but they would probably be too small in practice.

formula eval −0.5 −0.25 +0.25 +0.5
Lichess 2023 54.6% B : 45.4% W 52.3% B : 47.7% W 47.7% B : 52.3% W 45.4% B : 54.6% W
SF v16 @ move 0 54.7% B : 45.3% W 51.3% B : 48.7% W 48.7% B : 51.3% W 45.3% B : 54.7% W
SF v16 @ move 32 53.1% B : 46.9% W 50.8% B : 49.2% W 49.2% B : 50.8% W 46.9% B : 53.1% W
SF v16 @ move ≥120 52.9% B : 47.1% W 50.9% B : 49.1% W 49.1% B : 50.9% W 47.1% B : 52.9% W

Maybe:

  • ±0.5 pawneval = inaccuracy
  • ±1.0 pawneval = mistake
  • ±3.0 pawneval = blunder

within the stipulation that all evals larger than ±2.5 are to be considered virtually the same.

@yuzisee yuzisee force-pushed the dev-inaccuracy-mistake-blunder-colors branch from 35f7c68 to bfe200b Compare September 25, 2023 17:40
@yuzisee yuzisee marked this pull request as ready for review September 25, 2023 17:43
@yuzisee
Copy link
Author

yuzisee commented Sep 25, 2023

Rebased onto latest master, and updated after #244


For posterity, here's how the other platforms handle it:

chess.com

Note that chess.com also has a "Missed Win" annotation that is more severe than "Blunder".

Lichess

The Lichess rules are slightly different, and are based instead on win percentage change (±0.1, ±0.2, and ±0.3/0.5 — NOTE: Lichess defines cpWinningChances ranging from −1.0 to +1.0). Longer discussion is here #242 (comment)

@yuzisee yuzisee force-pushed the dev-inaccuracy-mistake-blunder-colors branch from bfe200b to 7887349 Compare September 25, 2023 17:51
* `table`.eval replaced with `SortedMoveInfoFromTable(table)[0].cp`
* blunder/mistake/inaccuracy defined in terms of centipawns, with the stipulation that all evals larger than ±2.5 are to be considered virtually the same.
@yuzisee yuzisee force-pushed the dev-inaccuracy-mistake-blunder-colors branch from 7887349 to f7ca196 Compare September 25, 2023 17:58
@yuzisee yuzisee force-pushed the dev-inaccuracy-mistake-blunder-colors branch from aa536db to ddcc292 Compare September 25, 2023 18:08
…han ±2.5 are to be considered virtually the same"
@yuzisee
Copy link
Author

yuzisee commented Sep 25, 2023

September 25, 2023:

  • Tested working on latest master
  • Screenshot updated above

yuzisee added a commit to yuzisee/nibbler-dev that referenced this pull request Sep 29, 2023
Help to reduce merge conflicts w/ rooklift#237
@yuzisee yuzisee force-pushed the dev-inaccuracy-mistake-blunder-colors branch from 57a1f22 to 8941e30 Compare September 29, 2023 02:26
yuzisee added a commit to yuzisee/nibbler-dev that referenced this pull request Sep 29, 2023
Help to reduce merge conflicts w/ rooklift#237
@yuzisee yuzisee force-pushed the dev-inaccuracy-mistake-blunder-colors branch from 8941e30 to 1342d2c Compare September 29, 2023 02:38
Reduce potential merge conflicts w/ rooklift#248
@yuzisee yuzisee force-pushed the dev-inaccuracy-mistake-blunder-colors branch from 1342d2c to 1b41cbf Compare September 29, 2023 02:46
yuzisee added a commit to yuzisee/nibbler-dev that referenced this pull request Sep 29, 2023
Help to reduce merge conflicts w/ rooklift#237
@yuzisee yuzisee force-pushed the dev-inaccuracy-mistake-blunder-colors branch from 678b9f2 to c6129b1 Compare October 1, 2023 21:53
(Also fix a couple bugs where blunders might not display, or
inaccuracy would be shown for good moves)
@yuzisee yuzisee force-pushed the dev-inaccuracy-mistake-blunder-colors branch from c6129b1 to c3a98bb Compare October 1, 2023 22:21
(CSS only)
@yuzisee yuzisee force-pushed the dev-inaccuracy-mistake-blunder-colors branch from a49514c to f17dc81 Compare October 1, 2023 22:47
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.

None yet

2 participants