-
Notifications
You must be signed in to change notification settings - Fork 16
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
draw simple (winning) endgame ? #9
Comments
If I may drop a line, such positions are trivial to calculate and an engine without tablebases can win them with no special efforts. Alex |
Hi and thanks to both of you for showing and commenting this position.
The attached position to this issue is not one of these two variants. In general, the special handling of endgame positions is not on the top of Bagatur features backlog. Most people will have internet or downloaded upfront Syzygy tables on their computers. Bagatur has incorporated a few syzygy TBs in ./data/egtb directory and they cover big amount of possible endgame positions as well as many more complex positions which at the end are decomposed to TB hits. OnlineSyzygy option sounds interesting. I will read and research about it ... Best regards, |
Alex wrote "..an engine without tablebases can win [such positions] with no special efforts.." and i agree : we might expect an engine is capable of winning this position, at least not giving its last pawn !? You explain why this happens because of how Bagatur works, even using its TBs, but anyhow ..
This seems rather easy, you can just call the API.
You mean the user can download TBs here .. well, the 3-5 pieces files are upto 1 Gb, which is realistic, but the 6 and 7 pieces files are too big for me .. using some online TB API is much easier (and works very fast). |
Hi, ok, let's keep this issue open until I succeed to implement this new feature.. Best regards, |
Take a look at my issue of the Weiss engine, at 14 July : TerjeKir/weiss#497 .. i guess you can just contact the creator how to implement the LiChess API. He seems willing to help. |
i have no idea how to program a chess engine .. i'm only beginning to understand the basics while using / testing several open source chess engines and communicate with their creators .. however, i have a fairly good understanding of the chess game, i'm a club player myself with rating about 1850 .. so, the fact that Bagatur is unable to win this endgame surprised me .. i have no clue how you can solve this, i guess the problem is at the core .. maybe this info can help you : i just stumbled upon this text of the Seer engine at https://github.com/connormcmonigle/seer-nnue : Seer is an original, strong UCI chess engine. Seer relies on a neural network estimating WDL probabilities for position evaluation. Seer's network is trained through a novel retrograde learning approach starting only from 6-man syzygy EGTB WDL values. These initial WDL scores are then iteratively backed up to 32-man chess positions using Seer's search to find continuations from N-man chess positions to N-1-man chess positions (implementation). Seer uses a conventional alpha-beta search combined with "Lazy SMP" (shared transposition table) for multithreading support. i know Bagatur does not rely on any NN, but maybe the approach of Seer (which is unique, i think) will inspire you .. |
Sounds very interesting! FYI: https://tablebase.lichess.ovh/tables/standard/ |
Hi, |
The author of Weiss had the same "problem" : i remember he wrote that the LiChess API does not accept too many requests (per time) which is logical and realistic -- i guess you should be able find this on his GitHub pages .. consulting such online service will always have some limit, isn't it ? |
Here is the remark of the Weiss author : |
Hi, the server is giving very often "Server returned HTTP response code: 429 Too Many Requests". At the end my measurements shows that only 1 request per 60 seconds is allowed. What time control are you using to run games? Best regards, |
1 request per 60 sec ? This can not be right .. maybe you can look into the Weiss code, to see how this author did it .. or just contact him when you don't succeed .. honestly, don't hesitate to do that .. i usually do about 8 minutes per player per game, with bonus 5 sec per move. |
Do you probe TB just one time per search? |
Hi, yes, exactly. |
Hi, I have an update here. Now the implementation is with adaptive waiting time between the server requests. I believe this is the best approach. What do you think? This big waiting times could be on my setup only, because I have created a lot of requests last 24h and my IP/MAC Address might be restricted from the server. On my laptop it works like this: Best regards, |
i have no idea .. you should discuss this with Alex .. or with Terje Kirstihagen of the Weiss engine. |
Yes, sure I will ... |
Hi and good day! :-) I have identified one blocker. This doesn't work. Any hints on how it should work are welcome !? I will contact Terje Kirstihagen to ask him about this issue as well but let's first do my homework. Best regards, P.S. Also it is very difficult to reproduce these issues without additional effort invested in special setup and code changes. Without this I have to wait a lot of time and check periodically to observe such issue. On my static tests with Syzygy and special set of positions it works. |
i do not fully understand what you mean, but that's my shortcoming, not being a chess programmer .. you should continue to investigate and test like you did .. then maybe contact another creator like Terje, and explain what you did to solve the issue, giving him enough input to help you. To my knowledge Weiss is the only engine which has implemented the online (LiChess) TBs. |
On the other hand i keep thinking any engine should be able to win a simple endgame like the one i posted in this issue, without TBs. But i can be wrong .. |
Yes, why the evaluation function doesn't work in this position is a different story, which I also have to look at ... :-) |
Hi, do you have the reported game in PGN format? In this position "k7/8/4Kp2/5P2/8/6b1/8/8 b - - 0 1" on my setup, without TBs, Bagatur plays well - Bg3e5. It finds the only best move even on depth 1: But in your game it plays Ka8b7 and lose the only pawn ... for now I cannot say much about this issue, it is not reproducible on my side. Best regards, |
indeed, when i test this position on my system, using SCID with MPV 1 or even more, Bagatur v2.3 plays Bg3-e5 almost immediately and keeps considering this move best until high depth : here's the zipped PGN : lozza-2.0_vs_bagatur-2.3.zip |
btw. it's about move 91 |
Note that my initial position, after Bagatur played 85...Kxb6, it reached the winning position and so i made the diagram .. this was an 8 minute game and the times you see (Lozza 00.08 and Bagatur 01.43) are the clock times when the game ended .. so Bagatur had enough time to calculate but it spent only 1.6 seconds on move 91...Kb7 !? Maybe it used its hash (normally i set 64 Mb for all engines) and thus decided to play the move .. i don't know .. it seems this issue takes another direction, maybe concerning the working of engines in CuteChess (or another GUI, i don't use Arena) .. in the meantime you're aware of the online TBs, so that's the positive side ! |
Yes, thanks a lot for your support! |
If you use fathom it handles any issues with probing syzygy in root. I have no idea what exactly it does for this. For online probing it will depend on what info the api you query gives you. I probe lichess which gives all the info you need from the current position, just parse the response and play whatever move it tells you to play. |
Hi and thanks for the prompt reply! ok, for offline probing in the root, I will check later fathom if I can understand the code at all ... Regarding the online probing. The issues, which I face with lichess online probing, are these 2:
Best regards, |
When I implemented it I got no timeouts unless both engines played ~instantly and kept querying every turn. Spamming it a bit manually worked fine now as well. I get a big json with info about both the position and each legal move. |
FYI: here are my first and last (for now) unsuccessful try of NNUE implementation: https://github.com/bagaturchess/Bagatur/tree/master/Sources/LearningImpl/src/bagaturchess/deeplearning/impl_nnue |
Thanks for the updates. Regarding training a NN for the 4Npos : i willl open a new Issue. There i will copy some of our texts, so we can continue from there, otherwise this Issue is getting too many different subjects, although they all are meant to improve Bagatur strength in the endgame. |
Thanks for creating different issues for each case! So, if we assume that this issue is for the online syzygy implementation, than the only open item is: "I don't know the answer of the following chess question, probably clear by chess theory. Is your understanding the same? Best regards, |
yes, the subject of this Issue is "draw simple (winning) endgame ?" and we ended with the idea to implement online syzygy.
In fact yes : when 7 or less pieces are on the board, we can reduce mistakes by querying the online syzygy wisely, so only when 'needed'. You propose "..can target draw as default, but don't miss opportunity and probability of win by doing moves, which have draw as target" and i think that is the right appraoch. i'm writing scenarios to implement this. |
Happy to hear that! :-) |
my current raw notes : I imagine / deduce 3 scenarios : Own eval tells a max-7-piece position is (probably) : scenario 1 query can give:
If WINNING is yet possible, although own eval was DRAW, Else if DRAW is possible, the query has confirmed own eval. Else if only LOSING is possible, just rely on own eval, which tells DRAW ! scenario 2 Although own eval tells WINNING, we query the online syzygy, which can give:
(------------writing) scenario 3 (------------writing) |
you see, i envision some states of the program and try to deduce them .. goal is to wisely query : not too often. |
if my logic of this idea is correct, you could even complete this scenario list or change it ? |
Thanks a lot for putting this together in text! |
For now I think the only save way is:
Is this correct from your perspective? We should not consider server request limits, they are handled in a good way - waiting time between to server requests is going up and down depending on the request limits, when they are reached. So the code will make calls to the server when it can. This is a separate logic, which we already have implemented. |
my idea with the scenarios is to provide a solution for querying the online-syzygy NOT TOO often. Or can you make a request EVERY move ? (as soon as max 7 pieces on the board) ? -- I guess not. |
If we can query the online-syzygy every move, then in fact those TBs will play the rest of the game !? And Bagatur will move almost instantly ! Am i wrong ? I remember Weiss playing that way .. did you ever test this engine with its online TB option ? |
We have to decuple this 2 things: the issue with availability of online TBs and the correct way of using them. The first issue can/will be solved later, not with the first version. The second one is to use TBs in most possible ways, which are correct - they only improve engine play. |
When we release the first version I will work more on the server limits. Than I will investigate this story, including Weiss behavior in more details. We even can create new issue for this and close this one, as it is too big now. :-) That is why I would like to release as fast as possible the Online Syzygy feature. |
OK .. close this Issue. Any further communication can be done by opening a new Issue, and copy some text parts from THIS Issue for reference, like i did in the "develop NN" issue .. OK ? |
Yes, just let's finish it. :-) |
OK, that's a first question to be continued .. when you close this Issue, will YOU open a new Issue for the online syzygy implementation ? I will wait for that and respond there, OK ? |
The new issue will be for the server limits only. |
Ok, I will start working on this tomorrow: "Generalize the idea with transposition table entries available from the last / latest own search. Now is time for relax! Machine learning and evaluation tuning always create pressure in my head ... ;-) |
I tried this night one tournament with latest Dev version against version 2.3 Looks very good! (although 118 games are not enough to say:-) ) This is with the changes made in this issue. |
Now, I will start working on the Online Syzygy logic, from here: P.S. I hate to parse texts, but we have to go through it! ;-) |
Here are the details, regarding the new code, which handles the online Syzygy feature in Bagatur:
Just in case, if someone is interested in this Java code ... |
Good news, regrading the server request limits! Waiting time between requests stay at 500 ms all the time! The issue was caused by the URL of the server, which I have used up to now: This one is used now: Best regards, |
There were some bugs in the logic, which I have fixed and now next tournament is running. |
Hi, for some reason there are still no logs from wins (mates) scores, I have to investigate why this happens. |
Happy New Year 2022! I wish good health and good mood! |
It's a pitty Bagatur (v2.3) does not play the endgame well without TBs .. in this position Bagatur draws with Black !?
This position is winning for Black (eg. see https://syzygy-tables.info/?fen=8/8/1k2Kp2/5P2/8/2b5/8/8_w_-_-_0_1 ) but Bagatur gives away its only pawn and this game ended in a draw. Why didn't Bagatur put the bishop on e5 and tried to capture the white pawn by forcing tempos ? I guess such positions, although they have few pieces, are hard to calculate but i can't imagine why ..
I have no TBs on my system. Did you know that online TBs exist, even the latest ones with 7 pieces? When the user has an internet connection while playing, an engine can consult these TBs, eg. see the 'OnlineSyzygy' config option of the Weiss chess engine ( https://github.com/TerjeKir/weiss/ ) which can query the online 7 piece Syzygy tablebases hosted by lichess.
The text was updated successfully, but these errors were encountered: