py-stockfish / stockfish

Integrates the Stockfish chess engine with Python (Official fork)
https://py-stockfish.github.io/stockfish/
MIT License
32 stars 9 forks source link

How does ELO relate to Skill Level? #56

Closed arikanev closed 1 year ago

arikanev commented 1 year ago

Hey guys, sorry for the 3x opening issues, just really enjoying using your Python package. I noticed that setting an ELO of 4000 gives weaker results than setting the skill level to 20. Do you guys have a direct equation describing the relationship between ELO and Skill Level?

Thanks! Ari

kieferro commented 1 year ago

Hey guys, sorry for the 3x opening issues, just really enjoying using your Python package

No problem <3

I noticed that setting an ELO of 4000 gives weaker results than setting the skill level to 20

The problem is that there is a maximum value (in this case 3190) for the Elo parameter. I don't know exactly what happens if you specify a higher value, but I would imagine that the value is simply ignored. Therefore we are also planning on adding checks for the maxima and minima (#28).

We can't say much about the general question, because it's about the engine itself and we only provide the interface. I found this stackexchange thread where a list is given. But if you really want reliable information, you have to ask in the official Stockfish repo. If you get some information, feel free to link it in this issue thread as well, and we'll be happy to include the information in our README.

arikanev commented 1 year ago

Thanks for the info! I opened an issue with the official repo. It looks like the Stockfish version I'm using is 14. Yes, a min-max threshold would be a good idea. Note that I observed that playing with a 4000 elo still gave decent moves, so I dont think its entirely ignored, maybe just mapped to the highest value possible.

https://github.com/official-stockfish/Stockfish/issues/4717

johndoknjas commented 1 year ago

Hi @arikanev, it's a bit confusing how elo and skill level work, but unfortunately that's just the way the uci protocol made things (and Stockfish implements this protocol). Basically it works like this:

arikanev commented 1 year ago

Yes! I've found that the max elo is not as good as the skill level of 20. That's interesting. Why is that? Are both the elo and skill level values affecting the same function that determines the engine performance? If they enable different functions, then by definition I guess they mean different things. If they affect the same function, there must be some direct mapping between the two!

johndoknjas commented 1 year ago

@arikanev I believe for elo the way it works is Stockfish runs as usual, but then they have some algorithm to sometimes select a lower ranked top move. Not sure about skill level but I'd assume they would work similarly.

For max elo vs skill level 20 though, the reason they're different is probably just because Stockfish's normal elo strength is higher. I'm not sure why they don't let you choose a max elo closer to Stockfish's elo (3500+). Maybe something about the algorithm needing buffer room between the two? Just speculating though.

arikanev commented 1 year ago

Interesting! Thanks for the info.