I saw the excellent Javascript-based guide to how Stockfish evaluates (non-NNUE). Is there a python version out there, perhaps using python-chess?

What I am trying to do (in case you have other suggestions for skinning this particular catfish): I plan to use this for didactic purposes. For various openings, I want to analyze how the different components of the evaluation function change in different lines (not sure what I am looking for, precisely, but clearly there is a trade-off between material/mobility/... that such an analysis may reveal).

In short, for a few thousand positions (not millions), I want a dictionary with keys such as "King Ring", "Weak Unopposed Pawn", etc.

If there is a python port of that javascript code, I can easily tweak it to my needs.

  • How about stackoverflow.com/a/58557648? Commented Dec 31, 2020 at 5:57
  • @double-beep, what that returns is the sum of all components (e.g., middle game eval and end game eval, each of which is made up of several components such as mobility, space, material). I am after the individual components. Commented Dec 31, 2020 at 6:30
  • @AbhijitMahabal - Have you seen this? github.com/glinscott/nnue-pytorch
    – JohnP
    Commented Aug 18, 2023 at 15:55


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.