bagaturchess / Bagatur

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

draw simple (winning) endgame ? #9

Closed tissatussa closed 2 years ago

tissatussa commented 3 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.

tissatussa commented 3 years ago

i found it ! Csi: Crime Scene Investigation: Season 14 - episode 16 "Killer Moves" (2013) webpage : https://putlockers.fm/watch/xz6w3bYx-csi-crime-scene-investigation-season-14/episode-16.html video : https://eplayvid.com/watch/bf8da5a3766cf7b

bagaturchess commented 3 years ago

Wow! ;-) Second link doesn't work for me and the first link opens many ads ... are they correct?

tissatussa commented 3 years ago

sorry, i should have known you'd have trouble with that .. especially when using Windows .. at first it was a challenge to find that CSI episode, but i did .. here's the description on their official website : https://www.csifiles.com/content/2014/02/csi-plays-the-royal-game-in-killer-moves/ .. from there i came to that PutLocker page, which is full of sh*t, i know .. many popups and maybe even virus malware, but not on Linux ofcourse :-) .. i have my tools and blockers to work around this .. for years i searched all kinds of media and saved them .. the second link is the actual iFrame URL where the video (player) is .. if you feed that URL into a decent download tool, it will grab that episode .. i can it send to you if you want, eg. by WeTransfer.

bagaturchess commented 3 years ago

Yes, sure, let's continue discussing CSI topic via email.

Over last 2 days, I have run 400 games on 1/1 time controls and there are only 2 successful calls to Online Syzygy and they work, although there is an error dump, because the search is already stopped and there is a second try. This is a minor issue. I should rethink a bit from threads / synchronization / asynchronous processing point of view ... UPDATE: I have fixed this and will have to wait at least 1 day to validate it with ~200 games. It is in progress on my setup and heating CPU Cores ... I have to get some device and measure the consumption of electricity power on my laptop in such days :-)

Have you succeeded to run some long games? They should produce much more successful Online Syzygy calls ... also the ELO is exactly the same of both versions (without TB and with Online Syzygy). On your setup, with much more successful calls, there should be at least 5 ELO benefit! :-)

image

Here is how these 2 logs are looking into the log file: ... "info string TO_GUI{Sat Nov 20 17:43:09 EET 2021}>info depth 26 seldepth 43 time 1116 nodes 804282 nps 720682 score cp 479 lowerbound hashfull 480 pv g5c5 b6b8 g3g4 b8h8 h5g5 h8g8 g5f5 f7e7 g4g5 e7d6 c5a5 d6c6 f5g4 c6b7 f4f5 b7b6 a5e5 b6c6 g5g6 g8g7 g4f3 c6d6 e5a5 d6e7 a5a7 e7e8 a7g7 e8f8 f5f6 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: json_response_text={"mainline":[{"uci":"g3g4","san":"g4","dtz":-6,"precise_dtz":null},{"uci":"b6b1","san":"Rb1","dtz":5,"precise_dtz":null},{"uci":"g5a5","san":"Ra5","dtz":-4,"precise_dtz":null},{"uci":"b1h1","san":"Rh1+","dtz":3,"precise_dtz":null},{"uci":"h5g5","san":"Kg5","dtz":-2,"precise_dtz":-2},{"uci":"h1a1","san":"Ra1","dtz":1,"precise_dtz":1},{"uci":"a5a1","san":"Rxa1","dtz":-2,"precise_dtz":-2},{"uci":"f7e6","san":"Ke6","dtz":1,"precise_dtz":1},{"uci":"f4f5","san":"f5+","dtz":-2,"precise_dtz":-2},{"uci":"e6d5","san":"Kd5","dtz":1,"precise_dtz":1},{"uci":"f5f6","san":"f6","dtz":-2,"precise_dtz":-2},{"uci":"d5c4","san":"Kc4","dtz":1,"precise_dtz":1},{"uci":"f6f7","san":"f7","dtz":-2,"precise_dtz":-2},{"uci":"c4b3","san":"Kb3","dtz":1,"precise_dtz":1},{"uci":"f7f8q","san":"f8=Q","dtz":-4,"precise_dtz":null},{"uci":"b3b2","san":"Kb2","dtz":3,"precise_dtz":null},{"uci":"a1c1","san":"Rc1","dtz":-2,"precise_dtz":null},{"uci":"b2a2","san":"Ka2","dtz":1,"precise_dtz":null},{"uci":"c1b1","san":"Rb1","dtz":-1,"precise_dtz":-1},{"uci":"a2b1","san":"Kxb1","dtz":3,"precise_dtz":null},{"uci":"f8f2","san":"Qf2","dtz":-2,"precise_dtz":null},{"uci":"b1a1","san":"Ka1","dtz":1,"precise_dtz":null},{"uci":"f2a2","san":"Qa2+","dtz":-1,"precise_dtz":-1},{"uci":"a1a2","san":"Kxa2","dtz":3,"precise_dtz":null},{"uci":"g5f4","san":"Kf4","dtz":-2,"precise_dtz":-2},{"uci":"a2a1","san":"Ka1","dtz":1,"precise_dtz":1},{"uci":"g4g5","san":"g5","dtz":-2,"precise_dtz":-2},{"uci":"a1b1","san":"Kb1","dtz":1,"precise_dtz":1},{"uci":"g5g6","san":"g6","dtz":-2,"precise_dtz":-2},{"uci":"b1a1","san":"Ka1","dtz":1,"precise_dtz":1},{"uci":"g6g7","san":"g7","dtz":-2,"precise_dtz":-2},{"uci":"a1b1","san":"Kb1","dtz":1,"precise_dtz":1},{"uci":"g7g8q","san":"g8=Q","dtz":-12,"precise_dtz":null},{"uci":"b1b2","san":"Kb2","dtz":11,"precise_dtz":null},{"uci":"g8g3","san":"Qg3","dtz":-10,"precise_dtz":null},{"uci":"b2a1","san":"Ka1","dtz":9,"precise_dtz":null},{"uci":"g3f2","san":"Qf2","dtz":-8,"precise_dtz":null},{"uci":"a1b1","san":"Kb1","dtz":7,"precise_dtz":null},{"uci":"f4e3","san":"Ke3","dtz":-6,"precise_dtz":null},{"uci":"b1a1","san":"Ka1","dtz":5,"precise_dtz":null},{"uci":"e3d3","san":"Kd3","dtz":-4,"precise_dtz":null},{"uci":"a1b1","san":"Kb1","dtz":3,"precise_dtz":null},{"uci":"d3c3","san":"Kc3","dtz":-2,"precise_dtz":null},{"uci":"b1a1","san":"Ka1","dtz":1,"precise_dtz":null},{"uci":"f2b2","san":"Qb2#","dtz":-1,"precise_dtz":-1}],"winner":"w","dtz":1,"precise_dtz":1} info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: current_index_for_waiting_time set to 0 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: winner_start_index=2423 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: winner_end_index=2435 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: winner_string="w" info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: bestmove_start_index=14 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: bestmove_end_index=26 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: bestmove_string=g3g4 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: dtz_start_index=38 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: dtz_end_index=46 info string TimeSaver.OnlineSyzygy: url connection terminated in 1152 ms info string TimeSaver.OnlineSyzygy: response from server:{"mainline":[{"uci":"g3g4","san":"g4","dtz":-6,"precise_dtz":null},{"uci":"b6b1","san":"Rb1","dtz":5,"precise_dtz":null},{"uci":"g5a5","san":"Ra5","dtz":-4,"precise_dtz":null},{"uci":"b1h1","san":"Rh1+","dtz":3,"precise_dtz":null},{"uci":"h5g5","san":"Kg5","dtz":-2,"precise_dtz":-2},{"uci":"h1a1","san":"Ra1","dtz":1,"precise_dtz":1},{"uci":"a5a1","san":"Rxa1","dtz":-2,"precise_dtz":-2},{"uci":"f7e6","san":"Ke6","dtz":1,"precise_dtz":1},{"uci":"f4f5","san":"f5+","dtz":-2,"precise_dtz":-2},{"uci":"e6d5","san":"Kd5","dtz":1,"precise_dtz":1},{"uci":"f5f6","san":"f6","dtz":-2,"precise_dtz":-2},{"uci":"d5c4","san":"Kc4","dtz":1,"precise_dtz":1},{"uci":"f6f7","san":"f7","dtz":-2,"precise_dtz":-2},{"uci":"c4b3","san":"Kb3","dtz":1,"precise_dtz":1},{"uci":"f7f8q","san":"f8=Q","dtz":-4,"precise_dtz":null},{"uci":"b3b2","san":"Kb2","dtz":3,"precise_dtz":null},{"uci":"a1c1","san":"Rc1","dtz":-2,"precise_dtz":null},{"uci":"b2a2","san":"Ka2","dtz":1,"precise_dtz":null},{"uci":"c1b1","san":"Rb1","dtz":-1,"precise_dtz":-1},{"uci":"a2b1","san":"Kxb1","dtz":3,"precise_dtz":null},{"uci":"f8f2","san":"Qf2","dtz":-2,"precise_dtz":null},{"uci":"b1a1","san":"Ka1","dtz":1,"precise_dtz":null},{"uci":"f2a2","san":"Qa2+","dtz":-1,"precise_dtz":-1},{"uci":"a1a2","san":"Kxa2","dtz":3,"precise_dtz":null},{"uci":"g5f4","san":"Kf4","dtz":-2,"precise_dtz":-2},{"uci":"a2a1","san":"Ka1","dtz":1,"precise_dtz":1},{"uci":"g4g5","san":"g5","dtz":-2,"precise_dtz":-2},{"uci":"a1b1","san":"Kb1","dtz":1,"precise_dtz":1},{"uci":"g5g6","san":"g6","dtz":-2,"precise_dtz":-2},{"uci":"b1a1","san":"Ka1","dtz":1,"precise_dtz":1},{"uci":"g6g7","san":"g7","dtz":-2,"precise_dtz":-2},{"uci":"a1b1","san":"Kb1","dtz":1,"precise_dtz":1},{"uci":"g7g8q","san":"g8=Q","dtz":-12,"precise_dtz":null},{"uci":"b1b2","san":"Kb2","dtz":11,"precise_dtz":null},{"uci":"g8g3","san":"Qg3","dtz":-10,"precise_dtz":null},{"uci":"b2a1","san":"Ka1","dtz":9,"precise_dtz":null},{"uci":"g3f2","san":"Qf2","dtz":-8,"precise_dtz":null},{"uci":"a1b1","san":"Kb1","dtz":7,"precise_dtz":null},{"uci":"f4e3","san":"Ke3","dtz":-6,"precise_dtz":null},{"uci":"b1a1","san":"Ka1","dtz":5,"precise_dtz":null},{"uci":"e3d3","san":"Kd3","dtz":-4,"precise_dtz":null},{"uci":"a1b1","san":"Kb1","dtz":3,"precise_dtz":null},{"uci":"d3c3","san":"Kc3","dtz":-2,"precise_dtz":null},{"uci":"b1a1","san":"Ka1","dtz":1,"precise_dtz":null},{"uci":"f2b2","san":"Qb2#","dtz":-1,"precise_dtz":-1}],"winner":"w","dtz":1,"precise_dtz":1} info string TimeSaver.OnlineSyzygy: EGTB probing was successful info string TimeSaver.OnlineSyzygy: winner=0, dtz=7, best_move=g3g4 info string TO_GUI{Sat Nov 20 17:43:09 EET 2021}>info depth 90 seldepth 90 time 1153 nodes 0 score mate 45 hashfull 480 pv g3g4 info string TO_GUI{Sat Nov 20 17:43:09 EET 2021}> LOG StateManager: sendBestMove called info string MTDSequentialSearch after loop final_mediator.getStopper().isStopped()=true, distribution.getCurrentDepth()=26, distribution.getMaxIterations()=90 info string MTDSequentialSearch not stopped - stopping searcher ... info string MTDSequentialSearch calling final_mediator.getBestMoveSender().sendBestMove() info string TO_GUI{Sat Nov 20 17:43:09 EET 2021}> LOG StateManager: sendBestMove called info string TO_GUI{Sat Nov 20 17:43:09 EET 2021}> LOG StateManager: sendBestMove bestMoveCommand=bestmove g3g4 info string TO_GUI{Sat Nov 20 17:43:09 EET 2021}>bestmove g3g4 info string TO_GUI{Sat Nov 20 17:43:09 EET 2021}> LOG StateManager: bestMoveCommand send info string TimeSaver.OfflineSyzygy: EGTB probing ok - syzygy move send to UCI: g3g4 info string java.lang.IllegalStateException: StateManager: ERROR: move returned from UCI Search adaptor is '0' and is not sent to the UCI platform info string at bagaturchess.uci.impl.StateManager.sendBestMove(Unknown Source) info string at bagaturchess.search.impl.rootsearch.sequential.SequentialSearch_MTD$1.run(Unknown Source) info string at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) info string at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) info string at java.lang.Thread.run(Unknown Source) info string StateManager: ERROR: move returned from UCI Search adaptor is '0' and is not sent to the UCI platform"

...

"info string TO_GUI{Sat Nov 20 17:43:22 EET 2021}>info depth 24 seldepth 32 time 84 nodes 97120 nps 1156190 score cp 688 lowerbound hashfull 490 pv g5g6 b4b7 h5g5 b7b8 f5c5 g8f8 f4f5 f8g7 f5f6 g7f8 c5c7 b8b5 g5g4 f8e8 c7c8 e8d7 g6g7 d7c8 g7g8q c8d7 f6f7 b5b8 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: json_response_text={"mainline":[{"uci":"g5g6","san":"g6","dtz":-8,"precise_dtz":null},{"uci":"b4b1","san":"Rb1","dtz":7,"precise_dtz":null},{"uci":"f5a5","san":"Ra5","dtz":-6,"precise_dtz":null},{"uci":"b1h1","san":"Rh1+","dtz":5,"precise_dtz":null},{"uci":"h5g5","san":"Kg5","dtz":-4,"precise_dtz":null},{"uci":"h1g1","san":"Rg1+","dtz":3,"precise_dtz":null},{"uci":"g5f6","san":"Kf6","dtz":-2,"precise_dtz":-2},{"uci":"g1a1","san":"Ra1","dtz":1,"precise_dtz":1},{"uci":"a5a1","san":"Rxa1","dtz":-2,"precise_dtz":-2},{"uci":"g8f8","san":"Kf8","dtz":1,"precise_dtz":1},{"uci":"a1a8","san":"Ra8#","dtz":-1,"precise_dtz":-1}],"winner":"w","dtz":1,"precise_dtz":1} info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: current_index_for_waiting_time set to 0 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: winner_start_index=605 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: winner_end_index=617 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: winner_string="w" info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: bestmove_start_index=14 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: bestmove_end_index=26 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: bestmove_string=g5g6 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: dtz_start_index=38 info string OnlineSyzygy.getWDL_BlockingOnSocketConnection: dtz_end_index=46 info string TimeSaver.OnlineSyzygy: url connection terminated in 199 ms info string TimeSaver.OnlineSyzygy: response from server:{"mainline":[{"uci":"g5g6","san":"g6","dtz":-8,"precise_dtz":null},{"uci":"b4b1","san":"Rb1","dtz":7,"precise_dtz":null},{"uci":"f5a5","san":"Ra5","dtz":-6,"precise_dtz":null},{"uci":"b1h1","san":"Rh1+","dtz":5,"precise_dtz":null},{"uci":"h5g5","san":"Kg5","dtz":-4,"precise_dtz":null},{"uci":"h1g1","san":"Rg1+","dtz":3,"precise_dtz":null},{"uci":"g5f6","san":"Kf6","dtz":-2,"precise_dtz":-2},{"uci":"g1a1","san":"Ra1","dtz":1,"precise_dtz":1},{"uci":"a5a1","san":"Rxa1","dtz":-2,"precise_dtz":-2},{"uci":"g8f8","san":"Kf8","dtz":1,"precise_dtz":1},{"uci":"a1a8","san":"Ra8#","dtz":-1,"precise_dtz":-1}],"winner":"w","dtz":1,"precise_dtz":1} info string TimeSaver.OnlineSyzygy: EGTB probing was successful info string TimeSaver.OnlineSyzygy: winner=0, dtz=9, best_move=g5g6 info string TO_GUI{Sat Nov 20 17:43:22 EET 2021}>info depth 90 seldepth 90 time 199 nodes 0 score mate 45 hashfull 490 pv g5g6 info string TO_GUI{Sat Nov 20 17:43:22 EET 2021}> LOG StateManager: sendBestMove called info string MTDSequentialSearch after loop final_mediator.getStopper().isStopped()=true, distribution.getCurrentDepth()=24, distribution.getMaxIterations()=90 info string MTDSequentialSearch not stopped - stopping searcher ... info string MTDSequentialSearch calling final_mediator.getBestMoveSender().sendBestMove() info string TO_GUI{Sat Nov 20 17:43:22 EET 2021}> LOG StateManager: sendBestMove called info string TO_GUI{Sat Nov 20 17:43:22 EET 2021}> LOG StateManager: sendBestMove bestMoveCommand=bestmove g5g6 info string TO_GUI{Sat Nov 20 17:43:22 EET 2021}>bestmove g5g6 info string java.lang.IllegalStateException: StateManager: ERROR: move returned from UCI Search adaptor is '0' and is not sent to the UCI platform info string at bagaturchess.uci.impl.StateManager.sendBestMove(Unknown Source) info string at bagaturchess.search.impl.rootsearch.sequential.SequentialSearch_MTD$1.run(Unknown Source) info string at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) info string at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) info string at java.lang.Thread.run(Unknown Source) info string TO_GUI{Sat Nov 20 17:43:22 EET 2021}> LOG StateManager: bestMoveCommand send info string StateManager: ERROR: move returned from UCI Search adaptor is '0' and is not sent to the UCI platform info string TimeSaver.OfflineSyzygy: EGTB probing ok - syzygy move send to UCI: g5g6" ...

Best regards, Krasimir

tissatussa commented 3 years ago

OK, i will email you about subjects beside this GitHub issue.

about the testing : i guess i will do that coming week .. at the moment i'm working on some creative project, so that can hardly wait :-)

bagaturchess commented 3 years ago

Ok, I will wait for update ... I wish you success with the creative project! ;-)

UPDATE: I am still working on the threads issue described above, but there are no other errors or any other "bad" behavior on my setup ... this is good. It means that when I am done and if it works on your setup as well, we can release the next stable version of Bagatur. It will need only one more final testing.

bagaturchess commented 3 years ago

Have you started the tournament? If not, I may give you directly my newest DEV version?

tissatussa commented 3 years ago

hi,

i'm ready to help you now .. but to be honest, i don't fully understand what i should do .. you wrote :

Could you please run some games on your setup?

Have you started the tournament? If not, I may give you directly my newest DEV version?

you can give me that newest DEV version .. in CuteChess i can setup a tournament, with any number of engines .. the setup can be done with this options page :

cutechess_tournament_setup

i filled some fields for such test, the other fields are default .. what should they be ? :

and the 'Players' : should this be 2 x Bagatur, so Bagatur is playing itself ? i did NOT often do such tournament ..

please elaborate on this, i can even let this run on a seperate PC, so i can still use my notebook for other things today : i have a model Intel NUC Kit D54250WYK, see https://tweakers.net/pricewatch/336068/intel-nuc-kit-d54250wyk/specificaties/ .. is the hardware of this NUC computer good enough ? It runs on Xubuntu 20.04 and it has a (fast) ethernet connection.

tissatussa commented 3 years ago

CuteChess even has a CLI version : run it in terminal .. maybe this is much faster / efficient.

bagaturchess commented 3 years ago

Hi and thanks for your help! Here is the latest DEV version: https://github.com/bagaturchess/Bagatur/releases/tag/TEMP_DEV_TO_BE_DELETED_Release_Candidate_of_OnlineSyzygy You could run this version against any other chess engine on your choice. You could also use Bagatur 2.3 version as an opponent of the latest dev version. This is up to you ... the (fast) ethernet connection is the most important piece, the CPUs power do not matter so much for this testing.

Regarding the time control, there should be at least 10 seconds increment per move. I would propose these options:

UCI options, which have to be set for the DEV version to produce logs:

Best regards, Krasimir

tissatussa commented 3 years ago

i ran one first test game, 1 minute + 10 sec. The opponent i choose was the latest Senpai v2.0 of the famous chess engine programmer Fabien Letouzey, father of good-old Fruit, see https://github.com/B4dT0bi/senpai.git - Senpai has a rating of about 3050, equal to Bagatur.

the game had 203 (!) moves and took about 1 hour ! It was an endgame with 2 Queens and some pawns. At some moment Bagatur had an eval of +30 (!) but the game ended in a draw (!?) because of the 50-move rule.

when 7 pieces and less were on the board, Bagatur did NOT move instantly .. that's strange to me, i expected it would have consulted the online TBs and thus move quickly. Also Bagatur should have known the result of the game, am i wrong ?

during the middlegame Bagatur gained much time due to the 10 sec bonus by moving rather fast, but in the endgame it used much time per move, which is good i think.

btw. i set ponder ON : "thinking in opponents time". That's OK ? Both engines did that.

here's the ZIPped log of this game : log.zip and here's the ZIPped PGN : testgame.zip

did Bagatur consult the online TBs ? I did not check this .. shall i do a full tournament with these settings ?

bagaturchess commented 3 years ago

Hi, this is great! I will check the log files ... Ponder ON was not tested by me! Good idea ... Best regards, Krasimir P.S. and of course I know Fruit, according to friend of mine, it was in "the root of all evil" regarding the topics "humans chess vs. computers chess" and "The begging of Clonings in chess engines".

bagaturchess commented 3 years ago

Ok, here is the outcome from the first run on your setup:

bagaturchess commented 3 years ago

Come on ... "info string TimeSaver.OnlineSyzygy: url connection terminated in 298 ms" On my laptop it takes up to 150 ms, your internet connection to their server is 2 times slower :-) Just kidding as it varies for each request. I have 10 seconds long responses for a few requests. But than I could add statistics to the logs. For average response time and its standard deviation + min/max response time ...

tissatussa commented 3 years ago

i'm not an expert in connections .. really, it's a weakness in my IT knowledge .. i did a test by some web service .. the log was saved at https://www.speedtest.net/result/12369767255 .. since a few months we have a fiber connection in thhis house, so it should be fast .. btw. i use Wifi, no cable.

tissatussa commented 3 years ago

when you test again and have a conclusion, maybe contact Terje again to consult .. i remember his Weiss engine has no troubles connecting the LiChess TBs fast.

tissatussa commented 3 years ago

we have to be sure my setup is OK before running a full tournament .. am i right ?

tissatussa commented 3 years ago

i don't understand "..winner is still unknown.." when 7 or less pieces on the board .. i think by connection to LiChess TBs, it should be known if a position is winning / losing / draw by optimal play ?

tissatussa commented 3 years ago

[ i will be out for some time today .. we'll discuss this later, OK? This evening i'm present again, to help you ]

bagaturchess commented 3 years ago

i don't understand "..winner is still unknown.." when 7 or less pieces on the board .. i think by connection to LiChess TBs, it should be known if a position is winning / losing / draw by optimal play ?

Currently Bagatur is not using draw scores, only +mate scores if any. Still the EGTB probing is disabled for all root positions, except winning moves reported by the server using OnlineSyzygy feature.

bagaturchess commented 3 years ago

when you test again and have a conclusion, maybe contact Terje again to consult .. i remember his Weiss engine has no troubles connecting the LiChess TBs fast.

I will check the build-in class HttpURLConnection, which I use. I have to ensure that the underlying socket connection is cached and not closed/opened for each server request ... the server may have limits for requests but also for connections. Normally much more requests are allowed from the same connection compared to the count of separate connections (with only 1 request per connection and connecting again each time). Currently, I am experimenting with these properties: HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(5 60 1000); // 0 = Infinite conn.setRequestProperty("Connection", "keep-alive"); ...

bagaturchess commented 3 years ago

we have to be sure my setup is OK before running a full tournament .. am i right ?

Why you think your setup is not working?

tissatussa commented 3 years ago

it also depends on the way your binary will be able to use my connection .. i can't help you with that .. what about my upload speed ? i have little knowledge of connections, for me they should just work ..

bagaturchess commented 3 years ago

I think everything will work on your setup with 30 seconds per move .... I am running shorter games on my setup at the moment in order to test the behavior of HttpURLConnection with different parametrers.

tissatussa commented 3 years ago

Why you think your setup is not working?

can you tell me about my connection ? - the speedtest analyses link .. is it fast or is my Wifi delaying ? I have no delay when browsing : my downloads are rather fast .. however, your requests are uploads, how quickly can those be done according to the speedtest ?

bagaturchess commented 3 years ago

I think it is ok. I am not in house but in apartment in a city, which probably have shorter optical cables, but should not matter at all ... We both have in average the same response times from lichess server.

tissatussa commented 3 years ago

so i can try 1 more test game with 30 sec per move .. and no bonus time ? I will send you the log and then, when you think it's OK, i can start that tournament with many games ? We don't want to run a full tournament when settings are unclear, isn't it ?

bagaturchess commented 3 years ago

Yes, your proposal is good. Not sure, whether 1 game will be enough, we need a game with clear winner in endgame (having +mate score). Otherwise we cannot verify whether it works on your setup. But, yes, please send me the log of the first game and than will discuss again. If there are issues we can update your version or if not, than we can continue the tournament with more games.

tissatussa commented 3 years ago

perfect ! good communication ! i will be back soon.

in the meantime you can watch the resulting chess video edit of my creative project : "how to draw a gun" https://www.bitchute.com/video/MJ264NJw8C9v/ .. it's an experiment in a position with a story .. read the description .. hope you like the music :-)

bagaturchess commented 3 years ago

Nice video! Kind of art, not only chess topic ... I would be even more happy when I see Bagatur playing in your next video! :-)

tissatussa commented 3 years ago

at this moment i'm running one or more test games with 30 sec per move, as you suggested .. i choose the position of my video ( 8/p5pp/1pk5/5p2/P1nn4/2NN3P/5PPK/8 w - - 0 27 ) as the starting position, not only to see how Bagatur handles it, but we can expect a mate sequence .. here are my settings :

settings_cutechess_30sec

tissatussa commented 3 years ago

that game just finished and Bagatur won .. from move 35 Bagatur thinks less then 1 second each move, reporting +M89 (!?) for many next moves .. however, it seems strange to me that Bagatur at move 47 reports +M29 (and it thought for 29 sec) and at move 48 it reports +M15 (and it also thought for 29 sec) .. after that, it's a "count down" from +M15 until +M1, but NOT all these moves were played within 1 second .. see the ZIPped game testgame - FabChess v1.16 -vs- Bagatur v2.3 dev - black wins.zip and the log testgame2 - log.zip

tissatussa commented 3 years ago

a second test game is just finished .. again i let Bagatur play Black in that position and it won .. the game also had a mate sequence, see the PGN and log : testgame - Nemorino v6.08 NNUE -vs- Bagatur v2.3 dev - black wins.zip testgame3 - log.zip

tissatussa commented 3 years ago

i await your reaction. NOTE: i set ponder OFF in both games.

tissatussa commented 3 years ago

we discuss requesting an online endgame TB .. opposed to that, lately i discovered that the (very strong) chess engine ShashChess (see https://github.com/amchess/ShashChess/ ) can use an online opening book : one of its UCI options is 'Live Book URL' : http://www.chessdb.cn/cdb.php .. did you know this? Can it be of any help to you?

bagaturchess commented 3 years ago

Thanks for the logs and the PGN file!

In this log file there are in total 22 calls to Online Syzygy server: • 4 responses “Server returned HTTP response code: 429” • 6 responses “EGTB probing ok - winner is still unknown” • 12 responses “EGTB probing ok - syzygy move set” - f2f1q, h7h6, a4a3, h6h5, f1f2, f2h4, h4h1, h5h4, h4h3, h3h2, h1f1, e2h2

The second log looks almost in the same way ...

So, it works well with 30 seconds per move on your setup. Regarding the wrong mate scores, I have to check the game. I have to look after move 47, right?

bagaturchess commented 3 years ago

we discuss requesting an online endgame TB .. opposed to that, lately i discovered that the (very strong) chess engine ShashChess (see https://github.com/amchess/ShashChess/ ) can use an online opening book : one of its UCI options is 'Live Book URL' : http://www.chessdb.cn/cdb.php .. did you know this? Can it be of any help to you?

Sure, it is similar idea to online syzygy, as it is online opening. :-) I could think about it in future ...

tissatussa commented 3 years ago

Regarding the wrong mate scores, I have to check the game. I have to look after move 47, right?

yes, about that move and further .. btw. i often see engines give +M137 or so .. this seems unreal .. when mate is near, the M# score often quiclky changes to a more realistic value .. i don't know how Bagatur calculates a Mate # ..

tissatussa commented 3 years ago

shall i do a full tournament now, with a set of engines ? Or are my single game tests enough for you ? Did you solve your http request timing issue due to my reports ?

Tell me how to set up such tournament : how many engines and which settings ?

bagaturchess commented 3 years ago

Yes, we are ready for tournament! :-)

Please use this Bagatur version, because it has more statistics in the log file: https://github.com/bagaturchess/Bagatur/releases/tag/TEMP_DEV_TO_BE_DELETED_Release_Candidate_of_OnlineSyzygy_more_statistics_in_logs +a few other engines up to your preference.

I still cannot fully solve this issue, with the server requests per minute limit, but this is not a blocker to release the first version of OnlineSyzygy if everything else works well. So, you help is valuable and speeds up the whole process for the next release. Thanks a lot!

I would increase the seconds per move from 30 to 33 or 35 in order to try to prevent all HTTP code 429 errors (there were 4/22 unsuccessful calls with 429 error in the first log file). A would switch on ponder, if possible. This also has to be tested before the release ...

+all other options as we use for the last run: SyzygyOnline set to true Logging Policy set to single file Offline TB path set to an empty location on the file system

Best regards, Krasimir

tissatussa commented 3 years ago

OK, but what is the advantage of a full tournament ? Maybe some games do not reach an endgame with some mate-in-# position or other positions where Bagatur will not be helped by the online TB ? However, I like to setup such tournament :-)

bagaturchess commented 3 years ago

Hm, yes, may be you could send me log from one game and them run a tournament ... this is also an option. Or if you start the tournament now, just send me the logs periodically ... another option.

tissatussa commented 3 years ago

on this, my main question is : what can you do with the resulting log of such tournament ? Can it help you improve your code ? Is it just about the request & access time of the TB probe ? My past games did not help ? Just asking ..

bagaturchess commented 3 years ago

So, for this new feature OnlineSyzygy we test the release candidate on 2 hardware setups, not only one. This is allays better ... ;-) I basically check all logs first for errors, than for specific data, like in this case for server response statistics on your setup. They are different than mine. With the last version, I sent you, there is average response times added + their max values and their standard deviations. So, I am looking forward for the new logs during the tournament ...

tissatussa commented 3 years ago

OK, that's clear .. i will run a tournament tonight, tomorrow i will send you the logs !

bagaturchess commented 3 years ago

Hi,

currently I am working on one endgame issue in your 4N position "8/p6p/1pk3p1/2n2p2/P1n5/2NN1K1P/5PP1/8 w - - 4 4" - Bagatur moves f3e2 and exchange knight, which is bad idea. Sometimes it also considers d3b4, is it better? :-)

I am trying to implement this idea "EXCHANGE MOTIVATOR": add to the static evaluation an portion of it (the static evaluation itself) multiplied by factor, which depends on the material left on the board. More details: Q=9, R=5, B=3, N=3 MAX MATERIAL is 62 (2 9 + 4 5 + 4 3 + 4 3) exchange_motivator[0]=1.0 state_counter=1 states_transitions count 3 states_transitions=[18, 6, 10] exchange_motivator[6]=0.5 state_counter=2 states_transitions count 3 states_transitions=[16, 24, 12] exchange_motivator[10]=0.5 state_counter=3 states_transitions count 3 states_transitions=[16, 20, 28] exchange_motivator[12]=0.25 state_counter=4 states_transitions count 3 states_transitions=[18, 22, 30] exchange_motivator[16]=0.25 state_counter=5 states_transitions count 3 states_transitions=[34, 22, 26] exchange_motivator[18]=0.5 state_counter=6 states_transitions count 3 states_transitions=[36, 24, 28] exchange_motivator[20]=0.25 state_counter=7 states_transitions count 2 states_transitions=[38, 26] exchange_motivator[22]=0.125 state_counter=8 states_transitions count 3 states_transitions=[32, 40, 28] exchange_motivator[24]=0.25 state_counter=9 states_transitions count 3 states_transitions=[34, 42, 30] exchange_motivator[26]=0.125 state_counter=10 states_transitions count 2 states_transitions=[32, 44] exchange_motivator[28]=0.25 state_counter=11 states_transitions count 3 states_transitions=[34, 38, 46] exchange_motivator[30]=0.125 state_counter=12 states_transitions count 2 states_transitions=[36, 40] exchange_motivator[32]=0.0625 state_counter=13 states_transitions count 2 states_transitions=[50, 38] exchange_motivator[34]=0.125 state_counter=14 states_transitions count 3 states_transitions=[52, 40, 44] exchange_motivator[36]=0.0625 state_counter=15 states_transitions count 2 states_transitions=[42, 46] exchange_motivator[38]=0.125 state_counter=16 states_transitions count 2 states_transitions=[56, 44] exchange_motivator[40]=0.0625 state_counter=17 states_transitions count 2 states_transitions=[50, 46] exchange_motivator[42]=0.03125 state_counter=18 states_transitions count 1 states_transitions=[52] exchange_motivator[44]=0.0625 state_counter=19 states_transitions count 2 states_transitions=[50, 62] exchange_motivator[46]=0.03125 state_counter=20 states_transitions count 2 states_transitions=[52, 56] exchange_motivator[50]=0.03125 state_counter=21 states_transitions count 1 states_transitions=[56] exchange_motivator[52]=0.015625 state_counter=22 states_transitions count 1 states_transitions=[62] exchange_motivator[56]=0.015625 state_counter=23 states_transitions count 1 states_transitions=[62] exchange_motivator[62]=0.0078125 state_counter=24 states_transitions count 1 states_transitions=[62]

We have 24 different material factors. The players make transitions when exchanging pieces. The last line [62] has 62 material factor - these are when we have all pieces The first line [0] has 0 - all pieces are gone. We use the numbers right to '=' as multiplier/factor and add the result to existing static evaluation of the current position: eval += factor * eval;

In 4N position, we have exchange_motivator[12]=0.25 and when exchanging one knight, it becomes exchange_motivator[6]=0.5. So, if the players exchange 1 knight than the factor will go from 0.25 to 0.50. It will become 2 times bigger. In our position if we assume that the white is -100 then we have: before the exchange: eval = -100 + 0.25(-100) = -125 after the exchange: eval = -100 + 0.50(-100) = -150

The problem now is that it doesn't work! Still the engine is making f3e2 instead of for example d3b4 ... Any ideas why it doesn't work? For example is this -25 cp difference enough from your perspective?

Best regards, Krasimir

bagaturchess commented 3 years ago

Update: I made a few tests. When it becomes 4 times bigger, Bagatur starts considering d3b4 instead of f3e2. this means the evaluation goes to -200. This looks to me as too big difference ... what do you think?

tissatussa commented 3 years ago

Update: I made a few tests. When it becomes 4 times bigger, Bagatur starts considering d3b4 instead of f3e2. this means the evaluation goes to -200. This looks to me as too big difference ... what do you think?

i quickly tested this position with some strong engines : both Nd3b4 and Kf3e2 are about equal eval, but i think Nd3b4 is better regarding the principle "avoid exchanges when you're behind in material", because White has 1 pawn less ..

your reasoning with exchange_motivator seems OK in general.

tissatussa commented 3 years ago

the tournament is finished .. i let 4 engines play 34 sec / move from "the 4N position", 8/p5pp/1pk5/5p2/P1nn4/2NN3P/5PPK/8 w - - 0 1 , each played 2 times against another engine, with White and Black :

tournament_result

here's the ZIPped PGN : tournament_34sec.zip here's the ZIPped log : Bagatur.zip

bagaturchess commented 3 years ago

Hi the log file gives me "Not Found" ...

I have tuned and tested exchange_motivator idea with 121 fast games with time corntol 1/1 image

With this change the latest dev version is 63 ELO weaker than Bagatur 2.3. I will do additional tuning and experiments ...