bagaturchess / Bagatur

Java Chess Engine (UCI compatible)
http://bagaturchess.github.io/Bagatur/
Eclipse Public License 2.0
64 stars 18 forks source link

draw simple (winning) endgame ? #9

Closed tissatussa closed 2 years ago

tissatussa commented 2 years ago

It's a pitty Bagatur (v2.3) does not play the endgame well without TBs .. in this position Bagatur draws with Black !?

bagatur_draw

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.

AlexBrunetti commented 2 years ago

If I may drop a line, such positions are trivial to calculate and an engine without tablebases can win them with no special efforts. So the problem has nothing to do with TBs,

Alex

bagaturchess commented 2 years ago

Hi and thanks to both of you for showing and commenting this position. Yes, indeed, Bagatur has very little knowledge for endgames. I know that some engines have specific handling into the evaluation function for different endgame positions, which are covered by the chess books and chess theory. In regards to endgames, Bagatur supports only:

The attached position to this issue is not one of these two variants. It should work, I don't know how deep (after how many moves) is the pawn promotion and how much time has Bagatur to think about this position?

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, Krasimir P.S. what about here (scroll down and look at the right side) https://syzygy-tables.info/

tissatussa commented 2 years ago

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 ..

OnlineSyzygy option sounds interesting. I will read and research about it.

This seems rather easy, you can just call the API. Not so long ago i helped the author of Weiss with this and he implemented it very quickly .. you could find that Issue for more info.

P.S. what about here (scroll down and look at the right side) https://syzygy-tables.info/

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).

bagaturchess commented 2 years ago

Hi,

ok, let's keep this issue open until I succeed to implement this new feature.. I am open to check this API. Do you know whether we need permission from the owners or license in order to use it?

Best regards, Krasimir

tissatussa commented 2 years ago

Take a look at my issue of the Weiss engine, at 14 July : https://github.com/TerjeKir/weiss/issues/497 .. i guess you can just contact the creator how to implement the LiChess API. He seems willing to help.

tissatussa commented 2 years ago

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 ..

bagaturchess commented 2 years ago

Sounds very interesting! I have experience with NNs and tried them with Bagatur in the past anyway, for the evaluation function. To solve endgames issue with NNs is very good application!

FYI: https://tablebase.lichess.ovh/tables/standard/ A contains Syzygi and Gaviota TBs downloads: 3-4-5/ 24-Jun-2021 12:59 - 6-dtz/ 11-Apr-2018 19:47 - 6-wdl/ 11-Apr-2018 19:47 - 7/ 05-Sep-2018 21:58 - Best regards, Krasimir

bagaturchess commented 2 years ago

Hi, I have tried to call lichess API with, for example, this url http://tablebase.lichess.ovh/standard?fen=3k4/8/8/8/8/8/3P4/3K4_w_-_-_0_1 It takes 135 milliseconds to get back the response from the server. This means that the feature will work only if there is at least 150 milliseconds per move. I will set the minimum time per move to even 500 milliseconds to be on the save side. This feature will work only if there is more than 500 milliseconds per move. Is this ok from your perspective? Best regards, Krasimir

tissatussa commented 2 years ago

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 ?

tissatussa commented 2 years ago

Here is the remark of the Weiss author : I noticed if weiss plays vs itself with both using it, it queries too often and lichess refuses to respond sometimes, but should be fine as long as opponent isn't moving instantly as well.

bagaturchess commented 2 years ago

Hi,

the server is giving very often "Server returned HTTP response code: 429 Too Many Requests". Code 429 means "The user has sent too many requests in a given amount of time ("rate limiting")"

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, Krasimir

tissatussa commented 2 years ago

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.

AlexBrunetti commented 2 years ago

This means that the feature will work only if there is at least 150 milliseconds per move. I will set the minimum time per move to even 500 milliseconds to be on the save side. This feature will work only if there is more than 500 milliseconds per move.

Do you probe TB just one time per search?

bagaturchess commented 2 years ago

Hi, yes, exactly. The online request to the server is send once per search, in the begging, even before starting the search. My test games were with 1 minute per game +1 second per move. This doesn't work with such time control. It should be minimum 60 seconds per move in order to use this feature. Best regards, Krasimir

bagaturchess commented 2 years ago

Hi,

I have an update here.

Now the implementation is with adaptive waiting time between the server requests. It varies between the minimum of 500 ms (0.5 secs) and the maximum of 64000 ms (64 secs). Current waiting time is dynamically divided by 2 if server replies with good answers and is multiplied by 2 if the server returns error.

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: Try 1: OK Waiting 500 ms Try 2: FAILED Waiting 1000 ms Try 3: FAILED Waiting 2000 ms Try 4: FAILED Waiting 4000 ms Try 5: FAILED Waiting 8000 ms Try 6: FAILED Waiting 16000 ms Try 7: OK Waiting 8000 ms Try 8: FAILED Waiting 16000 ms Try 9: FAILED Waiting 32000 ms Try 10: OK Waiting 16000 ms Try 11: FAILED Waiting 32000 ms Try 12: FAILED Waiting 64000 ms Try 13: FAILED Waiting 64000 ms Try 14: OK Waiting 32000 ms Try 15: OK Waiting 16000 ms Try 16: FAILED Waiting 32000 ms Try 17: OK Waiting 16000 ms Try 18: FAILED Waiting 32000 ms Try 19: FAILED Waiting 64000 ms Try 20: FAILED Waiting 64000 ms Try 21: OK Waiting 32000 ms Try 22: FAILED Waiting 64000 ms Try 23: OK Waiting 32000 ms ...

Best regards, Krasimir

tissatussa commented 2 years ago

i have no idea .. you should discuss this with Alex .. or with Terje Kirstihagen of the Weiss engine.

bagaturchess commented 2 years ago

Yes, sure I will ... The code is pushed to github: https://github.com/bagaturchess/Bagatur/blob/master/Sources/EGTB/src/bagaturchess/egtb/syzygy/OnlineSyzygy.java I also have removed the old code and resources related with Gaviota TB support as it will be no longer needed. The source is available in git history of course ... Best regards, Krasimir

bagaturchess commented 2 years ago

Hi and good day! :-) I have stabilized the master branch of the Bagatur project, but had to disable the code for Offline and Online Syzygy probing in the root positions even before starting the search. This was experimental but doesn't work correctly at the moment.

I have identified one blocker. I think it is risky to use Syzygy probing at root positions. According to what I understand you have to make each possible move for given root position and check WDL for each move. Than you select all WIN moves (which are actually LOSS from opponent perspective) and select this one with smallest DTZ as best move.

This doesn't work. The engine moves correct moves but when it reach promotion move it doesn't move it. I assume this resets the DTZ and needs exceptional handling. This is not simple, you also need to care about whether the move is 3 fold-repetition, capture or even check and have special handling for those at least ...

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, Krasimir

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.

tissatussa commented 2 years ago

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.

tissatussa commented 2 years ago

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 ..

bagaturchess commented 2 years ago

Yes, why the evaluation function doesn't work in this position is a different story, which I also have to look at ... :-)

bagaturchess commented 2 years ago

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: info depth 1 seldepth 1 time 46 nodes 2 nps 43 score cp 0 lowerbound hashfull 0 pv a8b7 info depth 1 seldepth 1 time 83 nodes 4 nps 48 score cp 8 lowerbound hashfull 0 pv a8b7 info depth 1 seldepth 1 time 83 nodes 6 nps 72 score cp 24 lowerbound hashfull 0 pv a8b7 info depth 1 seldepth 1 time 83 nodes 8 nps 96 score cp 56 lowerbound hashfull 0 pv a8b7 info depth 1 seldepth 1 time 83 nodes 10 nps 120 score cp 120 lowerbound hashfull 0 pv a8b7 info depth 1 seldepth 2 time 84 nodes 19 nps 226 score cp 248 lowerbound hashfull 0 pv g3h4 info depth 1 seldepth 2 time 85 nodes 32 nps 376 score cp 338 upperbound hashfull 0 info depth 1 seldepth 2 time 85 nodes 36 nps 423 score cp 293 lowerbound hashfull 0 pv g3h4 info depth 1 seldepth 2 time 86 nodes 38 nps 441 score cp 315 lowerbound hashfull 0 pv g3h4 info depth 1 seldepth 2 time 86 nodes 43 nps 500 score cp 326 lowerbound hashfull 0 pv g3e5 info depth 2 seldepth 2 time 86 nodes 49 nps 569 score cp 387 lowerbound hashfull 0 pv g3e5 e6f7 info depth 2 seldepth 3 time 87 nodes 63 nps 724 score cp 394 upperbound hashfull 0 info depth 3 seldepth 3 time 88 nodes 90 nps 1022 score cp 371 upperbound hashfull 0 info depth 3 seldepth 4 time 89 nodes 103 nps 1157 score cp 363 lowerbound hashfull 0 pv g3e5 e6f7 a8a7 info depth 4 seldepth 4 time 89 nodes 117 nps 1314 score cp 363 lowerbound hashfull 0 pv g3e5 e6d5 a8a7 info depth 4 seldepth 6 time 95 nodes 172 nps 1810 score cp 371 lowerbound hashfull 0 pv g3e5 e6d5 a8b7 d5e6 b7c6 info depth 4 seldepth 6 time 98 nodes 215 nps 2193 score cp 386 upperbound hashfull 0 info depth 5 seldepth 6 time 105 nodes 365 nps 3476 score cp 370 upperbound hashfull 0 info depth 5 seldepth 6 time 106 nodes 407 nps 3839 score cp 362 lowerbound hashfull 0 pv g3e5 e6f7 a8b7 f7g6 b7a6 info depth 6 seldepth 6 time 108 nodes 448 nps 4148 score cp 362 lowerbound hashfull 0 pv g3e5 e6f7 a8b7 f7g7 b7a6 info depth 6 seldepth 6 time 108 nodes 481 nps 4453 score cp 370 lowerbound hashfull 0 pv g3e5 e6f7 a8b7 f7e7 b7a6 info depth 6 seldepth 7 time 110 nodes 532 nps 4836 score cp 386 lowerbound hashfull 0 pv g3e5 e6f7 a8b7 f7f8 b7a6 info depth 6 seldepth 8 time 117 nodes 716 nps 6119 score cp 417 upperbound hashfull 0 info depth 6 seldepth 8 time 120 nodes 847 nps 7058 score cp 401 lowerbound hashfull 0 pv g3e5 e6f7 a8b7 f7e6 b7c6 e6f7 info depth 7 seldepth 8 time 121 nodes 904 nps 7471 score cp 401 lowerbound hashfull 0 pv g3e5 e6f7 a8b7 f7e6 b7c6 e6f7 c6d5

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, Krasimir

tissatussa commented 2 years ago

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 :

k7_84Kp2_5P2_8_6b1_8_8 b - - 0 1

here's the zipped PGN : lozza-2.0_vs_bagatur-2.3.zip honestly, i did not alter anything .. it really happened that way .. maybe it has something to do with playing in CuteChess, but i have no clue ..

tissatussa commented 2 years ago

btw. it's about move 91

tissatussa commented 2 years ago

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 !

bagaturchess commented 2 years ago

Yes, thanks a lot for your support! Most probably this is caused by transposition hash table entries and happens in very rare cases and it is close to impossible to reproduce. I would add even more positives to online syzygy idea - I faced the issues with the probing in the root search positions, which is important not only for online probing but also for offline probing. Now I have to solve it ... Best regards, Krasimir P.S. I have invited Terje Kirstihagen here to give us hints! :-) https://github.com/TerjeKir/weiss/issues/558

TerjeKir commented 2 years ago

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.

bagaturchess commented 2 years ago

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. I also use the same service of lichess. Actually, I was pointed out by tissatussa to OnlineSyzygy UCI option / feature of Weiss.

The issues, which I face with lichess online probing, are these 2:

Best regards, Krasimir

TerjeKir commented 2 years ago

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.

bagaturchess commented 2 years ago

Thanks for sharing this! the server rejects are probably because of my setup, which is good. I made the waiting time to vary between 500 ms and 64000 ms. So if there are no rejections than it will do calls 2 times in second.

Also there were one request, which was successful but too long as duration. Normally I get response from server for 150 ms. This long time was 1500 ms - 10 times longer than average. How you handle this? It should not be synchronous call before the search, but rather the search and the server request should work in parallel. If the server request has winner, you just stop search and move it, right? Later I may have question for the json, for now it works and I cannot test it right now, as I have to resolve ELO regression introduced by my EGTB changes last days. Need time to run games, test etc ... Best regards, Krasimir

TerjeKir commented 2 years ago

I do it before search starts, just like normal syzygy root probe, and I don't do anything to handle slow connection/replies. This is not intended for use in games that "matter" (tcec, rating lists etc), so I won't bother doing anything beyond the most simple/naive implementation. I expect the user to only enable online syzygy when they give the engine enough time to actually use it :)

bagaturchess commented 2 years ago

Ok, nice! :-) I will do it in parallel, additional to the search, because otherwise the engine will end up with loss on time in short time controls ... when the time per move is less than the server response time (150 ms). If you have 200 ms per move it is also risky as sometimes the server replies after 1500 ms ... Best regards, Krasimir

bagaturchess commented 2 years ago

Also, one update on the TB usage in search and in root positions. I have added this check "distanceToDraw_50MoveRule >= dtz" (again), without it the code of EGTB probe in search, doesn't work correctly at all, even the ELO is -30 less than without TBs: //Winner is minimizing DTZ and the loser is maximizing DTZ switch (wdl) {
case SyzygyConstants.TB_WIN:

                    int distanceToDraw_50MoveRule = 100 - env.getBitboard().getDraw50movesRule();
                    //Although we specify the rule50 parameter when calling SyzygyBridge.probeSyzygyDTZ(...)
                    //Syzygy TBs report winning score/move
                    //but the +mate or +promotion moves line is longer
                    //than the moves we have until draw with 50 move rule
                    //! Without this check, the EGTB probing doesn't work correctly and the Bagatur version has smaller ELO rating (-35 ELO)
                    if (distanceToDraw_50MoveRule >= dtz) {
                        return 9 * (distanceToDraw_50MoveRule - dtz);
                    }

} Do you use the same code in Weiss integration with syzygy TBs? Best regards, Krasimir P.S. I am a bit unsure whether it should contains '=' or should be only '>' to be on the safe side :-)

tissatussa commented 2 years ago

hi! Although i do not understand all these techniques, it's nice to see programmers discuss such issue and helping eachother !

I sense some misunderstanding though .. you both write english, but perfectly .. and C opposed to Java are used .. maybe you can point to some C code which does the requests ? And is Fathom handy or needed ? Also, 'a big json with info' opposed to (many) 'JSONs with "winner"' ?

Are you running on Windows ? I'm using Linux, so then maybe i can do tests eg. with that response time issue ? I have a fast connection here and no IP-blockage by too many requests .. such dev version can do a log ..

the Weiss engine runs fine on my Linux and its online TB function has no problems .. Terje, i remember you only had some small problem regarding those 'too many requests' and fixed it within a day or so, wasn't it ?

bagaturchess commented 2 years ago

Hi Tissatussa and thanks for you offer! I will made use of it definitely! :-) I just first need to solve my own problems with the DEV version. When I get to a point without ELO regression I can share with you the DEV version with enabled logs. Then we can make one run of 1h and then I will check the logs. This will be extremely helpful! Best regards, Krasimir P.S. I am from Bulgaria and I am happy that you like my English. :-) ... don't think the programming language matters at all when we talk about programming ...

tissatussa commented 2 years ago

don't think the programming language matters at all when we talk about programming

you are right .. sure, i know that :-)

so i was right : you can only use Windows ? i'm from Holland .. i mainly do web programming, PHP, javascript and also Python now .. i'm auto didact, i mean self-learning .. and i have my own logic .. being a creative chess player .. i like your attitude and responses ! I'm hoping to find a same mind .. i have some alternative ideas regarding engines, i want to share ..

in 1980-1983 i studied hardware and even assembly language .. nowadays i'm very happy with Linux .. i learn many things by just googling and reading open source code & texts .. we can build everything ! [ VIDEO Water Wall - hope you like my channel ]

bagaturchess commented 2 years ago

Thanks for sharing the channel, I will have a look ... No, I use linux as well but on virtual machine under windows using Hyper-V. :-) It is more difficult setup, but sometimes I have to test under linux. This summer I even have rented a linux/centos VM with 256 CPUs from Cloud provider, to test SMP version's scalability. There was a scalability issue during TCEC. The VM was necessary only for 2 hours and the cost for 2h was not big, but it was very difficult to get such machine from all Cloud providers, because it has too many CPUs and you need special sub-sellers/local-providers to work with. Best regards, Krasimir

tissatussa commented 2 years ago

mmm .. i understand .. i'm not into special hardware .. just using a modern notebook .. i guess you know linux can also run by dual boot or even "Live-CD" (even by USB boot) .. i don't know .. for more then 10 years i left Windows .. or maybe some of your dev and test apps only run on Windows ? Btw. I do no Java .. it runs nicely on my PC, and i can manage .jar files, but that's all .. so, i can only test some final (dev) binary, no code .. when communicating with other programmers, my experience is that i often only have to test well and give relevant feedback to tackle problems and improve the code. This may sound vague :-)

i basicly understand what engine programmers do to develop and improve their code .. but i always like to keep things simple and for me it all starts with a good (simple) idea, then the main "problems" should be solved to create it, details later .. a solid base, but easily extendable .. this can be done in a thousand ways, each of own style and approach -- i mean you can optimize with fast machines and batch-testing or so, but when some PSTs or piece values are wrong, what will be the result of any pruning ? Can you elaborate on how you did start building Bagatur ?

bagaturchess commented 2 years ago

Ok, I think this issue will have interesting notes and history at the end ... but why not ... I have never wrote a line about the beginning of Bagatur project in the late 1999. Could also say 2000, but I think 1999 sounds better! These are the old days! :-) Later I can even create a web page if you like the content. :-)

So, at the end, you are programmer, who know enough to start programing. May I ask you if you MUST start, right now, writing a chess engine and no way to go out of this duty, than what will be your preference for programing language and why?

tissatussa commented 2 years ago

I like to discuss general (engine) programming issues with you, but maybe not too much in this GitHub issue .. i will keep it short then :

i want to run such engine on all systems : Windows, Apple and Linux (later maybe Android ?), so different compiles must be done from one source code .. i guess C is fast and preferable but i don't do C (once i did only some basics) .. i know JS 'by heart' and i know some engines exist (like Lozza) which are JS based .. i also have engines which are Python, which i also do program .. but Python seems relatively slow .. maybe some compiler / method exists to convert Python in C or else, i wonder .. i never did Java .. i'm a functional programmer, keeping things simple (but complete), only using & combining existing classes .. i have no interest in learning another language .. i hardly worked with node.js but i want to .. in the recent past i used IDE to program, but now i only use a good editor and terminal .. i created some nice (chess engine) GUIs with TKinter & Python .. besides that i do PHP, but i guess this does not suit for a chess engine (although i once build a web page to play Fisher Random chess with a Stockfish linux binary .. you can hand me a suitable setup for my skills and wishes ?

bagaturchess commented 2 years ago

You know enough programming languages and can start immediately ... please let us know when to expect the first version of your engine? I think, that 800 ELO is perfect target for the first version!

Hm, I am surprised by what you are saying about the Python. I think it is now quite popular. For example a lot of examples in internet for AI / Machine Learning are in Python ... if I am not wrong, according to the statistics, it is even more popular than Java nowadays. Is it really too slow? How many times compared to C ? Java was up to 2 times slower than C, but this has changed last years ... but factor of 2 or even 4 doesn't meter soo much as long as you are not creating the new Stockfish version.

I think that C is always good choice as well.

I have selected Java mainly because my experience with it was bigger, no other reason ... the same logic as you have.

According to CCRL, there are below 500 chess engines in the world. This means that not many people are really interested in programming chess engines. Most probably the author of a chess engine is interested not only in programming but also in chess game. He/she must have enough willingness to invest spare time in chess programing, without any incentives, just for fun and driven by curiosity. I don't know for the other authors but I would add that small and balanced portion of craziness also helps here a lot ... Because of this fact, I am always happy to see new engines and new authors!

tissatussa commented 2 years ago

thanks, yes in that case i will be a new author soon :-)

what i said about Python is not based on current specifications .. i loose track, being old-school .. some Python engines -and only these type- slow down my notebook considerable, they even almost freeze the CPU by 100%, many times during a game in CuteChess .. i once started examining the SunFish code, all Python, it's also a LiChess bot now .. i created a GUI to play SunFish with a mouse, just embedding (and debugging!) the code - find it on GitHub .. but i did not try to change the evaluation / search / etc in any way .. this simple engine, i think mainly based on a few PSTs and some piece values, reaches higher depth slowly .. say dp 7 in 30 seconds where SF 14 can reach dp 25 -- just a raw compare .. i mean, Python feels slow, i once experimented with the asmFish version of SF 10 those days .. it's an assembler version and very fast .. therefor i think i prefer compiling Python or even JS into assembly, or C .. i imagine that would be a simple method - or impossible ? I mean it's important to choose a good setup and nowadays many new software exists, i'm not aware of .. esp. for multi-platform .. eg. did you ever do node.js or any JS ? The language is no longer only for web .. is node.js fast ? (i compare to C, with is fastest - agree?) Does a list exist of engine speed, eg. by perft ?

besides that, the programming itself will have some idea .. me also, being a programmer and chess player .. i see many programmers started with some template or other (simple) engine with clear code, and alter it .. i work like that also, but normally with other software .. creating my own chess engine will not be based on the worldly chess programming wiki's and their constructs .. i did many small tests with scripts in terminal, like a move generator, perft, etc .. weird experiments, nothing serious though .. to be honest, i'd like finding someone to share my thoughts on this - i will send you an email, and communication can be beside this GitHub issue ?

bagaturchess commented 2 years ago

Yes, sure, I am willing to help you in this ... I don't have enough experience with node.js and JS, cannot say.

Just for the protocol in this issue and to not say later that I haven't warn you: there was one episode of the TV series "CSI: Miami" and the bad guy was chess programmer. It could be co-incident, but to be on the safe side, always be careful with people, who program chess engines in their spare time! Of course, you will notice, your friends and people around you will become more careful with you, once you start creating chess engine yourself and non-stop talking to them about it ...

One additional remark: I would recommend to start from something existing. Just select programming language and select open source engine, which is simple and you understand and like its code most. Select one with less lines of code, no matter what is the ELO rating ...

tissatussa commented 2 years ago

thanks for these words .. i'm surprised by them, and i question your position in this, since 1999 .. anyhow, i almost never talk about it with other people .. they know i'm a chess player though .. [ you can close this Issue now - further by email ]

bagaturchess commented 2 years ago

Ok, so, this for "CSI: Miami" was a joke! Obviously unsuccessful joke ;-))) The real part is that I really talked too much about Bagatur to my friends. They were bored at some point in time. Don't do the same ... ;-) I will keep the issue for a while, because for example I am waiting a reply from Terje ...

tissatussa commented 2 years ago

i get it ... CU

bagaturchess commented 2 years ago

FYI: the first public and open source version of Bagatur was available since 2011-02-27 here (v100): https://sourceforge.net/projects/bagaturchess/files/BagaturEngine/older/ The project actually started ~10 years before this date and it had many proprietary non-public versions. I even don't have history of them but they were quite weak in playing chess ... first versions just succeeded to play 2-3 moves and then crashes ... I have spend hours and days trying to find why it doesn't work. This gives you diverse programming experience ... So, better start earlier, you need time to achieve 800 ELO without crashes! :-)

Bagatur project started as a bet between myself and one of my first chess player friends from my first 2 years in the University. I was unable to win a single chess game against him! This made me nervous over the months and at the end I have promised him (we bet) that I will create a chess program, which will win a game against him! Fortunately the time frame was not mentioned during the bet and some years later I win it! :-)

I was not aware of softwares running chess engines like CuteChess, Arena and the existence of the UCI protocol. I created also own GUI based on Java AWT and Swing.

bagaturchess commented 2 years ago

Hi, I have now stable version with all regressions fixed: https://github.com/bagaturchess/Bagatur/releases/tag/TEMP_DEV_TO_BE_DELETED_Alpha_Testing_of_OnlineSyzygy

Also the UCI option for OnlineSyzygy is implemented and added and working without errors. I cannot test it, because of my high waiting time, between the server requests. The games are running for last 3 hours, but still in the log files I cannot find these 2 log texts:

The probability to have winner exactly when the server response is ok is rather low on my setup ...

Could you please run some games on your setup?

The UCI options, which we need are: SyzygyOnline set to true Logging Policy set to single file Offline TB path set to an empty location on the file system The time control should be at least 1 second per move but I think we need even more time per move in the test games - 1 minute per move. But also we need test with 1 second per move to check whether the server is rejecting your setup as well or it is working fine on it.

At the end I will need the log file ...

Please let me know in case of questions and thanks a lot for your offer!

Best regards, Krasimir

tissatussa commented 2 years ago

OK, i will start testing this tomorrow. have a nice day ! greetings, Roelof

tissatussa commented 2 years ago

today i didn't get the time to act upon this .. i will let you know soon ! Have a good weekend !

5_40