Skip to content
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

Strange behaviour under Windows #518

Closed
SzotsGabor opened this issue Oct 26, 2023 · 10 comments
Closed

Strange behaviour under Windows #518

SzotsGabor opened this issue Oct 26, 2023 · 10 comments

Comments

@SzotsGabor
Copy link

Hi Jay,

I'm on Windows 11. Starting Berserk 12 from the command line this is what I see:

  1. Typing 'uci' nothing happens.
  2. Typing 'position startpos' nothing happens.
  3. Typing 'go depth 24' nothing happens.
  4. Now pressing any key (e.g. 'a') I get what I expected to get when typing 'uci'.
  5. Now again position startpos and go depth 24 do nothing.
  6. However, now typing 'a' I get what I should have got after typing 'go depth 24'.

To make it all clear this is how it went:

uci
position startpos
go depth 24
a
id name Berserk 12
id author Jay Honnold
option name Hash type spin default 16 min 2 max 131072
option name Threads type spin default 1 min 1 max 256
option name SyzygyPath type string default
option name MultiPV type spin default 1 min 1 max 256
option name Ponder type check default false
option name UCI_ShowWDL type check default true
option name UCI_Chess960 type check default false
option name MoveOverhead type spin default 300 min 100 max 10000
option name Contempt type spin default 0 min -100 max 100
option name EvalFile type string default
uciok
go depth 24
position startpos
go depth 24
a
info string time -1 start 1266925031 alloc 0 max 2147483647 depth 24 timeset 0 searchmoves 0
info depth 1 seldepth 1 multipv 1 score cp 52 wdl 164 825 11 nodes 24 nps 24000 hashfull 0 tbhits 0 time 1 pv d2d4
info depth 2 seldepth 2 multipv 1 score cp 75 wdl 271 723 6 nodes 47 nps 47000 hashfull 0 tbhits 0 time 1 pv d2d4 a7a6
info depth 3 seldepth 3 multipv 1 score cp 83 wdl 315 680 5 nodes 82 nps 82000 hashfull 0 tbhits 0 time 1 pv c2c4 a7a6
info depth 4 seldepth 4 multipv 1 score cp 58 wdl 187 804 9 nodes 137 nps 137000 hashfull 0 tbhits 0 time 1 pv c2c4 a7a6 a2a3
info depth 5 seldepth 5 multipv 1 score cp 92 wdl 367 629 4 nodes 397 nps 397000 hashfull 0 tbhits 0 time 1 pv e2e4
info depth 6 seldepth 6 multipv 1 score cp 85 wdl 327 669 4 nodes 704 nps 704000 hashfull 0 tbhits 0 time 1 pv e2e4 c7c5 g1f3 g7g6 d2d4
info depth 7 seldepth 8 multipv 1 score cp 53 wdl 167 822 11 nodes 2254 nps 2254000 hashfull 0 tbhits 0 time 1 pv d2d4 g8f6 g1f3 d7d5 c2c4 d5c4
info depth 8 seldepth 9 multipv 1 score cp 49 wdl 152 836 12 nodes 4123 nps 4123000 hashfull 1 tbhits 0 time 1 pv e2e4 c7c5 g1f3 e7e6 b1c3 b8c6 d2d4 c5d4 f3d4
info depth 9 seldepth 12 multipv 1 score cp 57 wdl 182 808 10 nodes 9309 nps 620600 hashfull 3 tbhits 0 time 15 pv e2e4 e7e5 g1f3 g8f6 f3e5 f6e4
info depth 10 seldepth 12 multipv 1 score cp 53 wdl 169 820 11 nodes 13525 nps 901666 hashfull 5 tbhits 0 time 15 pv e2e4 c7c5 g1f3 e7e6 f1e2 b8c6 c2c3 g8f6 e4e5 f6d5 e1g1 f8e7
info depth 11 seldepth 15 multipv 1 score cp 47 wdl 146 841 13 nodes 28863 nps 931064 hashfull 12 tbhits 0 time 31 pv e2e4 e7e6 d2d4 d7d5 b1d2 c7c5 e4d5 e6d5 g1f3 b8c6 f1b5 d8e7
info depth 12 seldepth 16 multipv 1 score cp 48 wdl 150 838 12 nodes 37668 nps 1215096 hashfull 15 tbhits 0 time 31 pv e2e4 e7e6 g1f3 d7d5 e4e5 c7c5 c2c3 b8c6 d2d4 d8b6 f1e2 c8d7 e1g1 c5d4 c3d4
info depth 13 seldepth 18 multipv 1 score cp 48 wdl 150 838 12 nodes 67931 nps 1445340 hashfull 25 tbhits 0 time 47 pv e2e4 e7e6 d2d4 d7d5 b1d2 c7c5 g1f3 g8f6 e4e5 f6d7 c2c3 b8c6 f1d3 f8e7 e1g1 c5d4
info depth 14 seldepth 22 multipv 1 score cp 45 wdl 139 848 13 nodes 104001 nps 1677435 hashfull 38 tbhits 0 time 62 pv e2e4 e7e6 d2d4 d7d5 e4e5 c7c5 c2c3 d8b6 g1f3 b8c6 f1e2 c8d7 e1g1 c5d4
info depth 15 seldepth 23 multipv 1 score cp 38 wdl 117 867 16 nodes 166982 nps 1776404 hashfull 60 tbhits 0 time 94 pv e2e4 e7e6 d2d4 d7d5 e4e5 c7c5 c2c3 d8a5 d4c5 a5c7 b2b4 c7e5 f1e2 e5c7 g1f3 g8f6
info depth 16 seldepth 22 multipv 1 score cp 56 wdl 179 811 10 nodes 204659 nps 1877605 hashfull 72 tbhits 0 time 109 pv e2e4 e7e6 d2d4 d7d5 e4e5 c7c5 c2c3 d8b6 g1f3 c5d4 c3d4 c8d7 f1d3 g8e7 e1g1 e7c6
info depth 17 seldepth 21 multipv 1 score cp 51 wdl 162 827 11 nodes 289782 nps 1857576 hashfull 106 tbhits 0 time 156 pv e2e4 e7e6 d2d4 d7d5 e4e5 c7c5 c2c3 d8b6 f1d3 c5d4 c3d4 c8d7 g1f3 d7b5 d3b5 b6b5 b1c3 b5a6 c3e2 g8e7
info depth 18 seldepth 27 multipv 1 score cp 49 wdl 152 836 12 nodes 563431 nps 2005092 hashfull 199 tbhits 0 time 281 pv e2e4 c7c5 g1f3 g7g6 c2c3 g8f6 e4e5 f6d5 d2d4 c5d4 c3d4 f8g7 f1c4 d5b6 c4b3 e8g8 e1g1 b8c6 f1e1 d7d6
info depth 19 seldepth 30 multipv 1 score cp 30 wdl 97 883 20 nodes 1556036 nps 2074714 hashfull 545 tbhits 0 time 750 pv e2e4 c7c5 g1f3 e7e6 c2c3 g8f6 e4e5 f6d5 d2d4 c5d4 c3d4 d7d6 b1c3 d6e5 f3e5 f8b4 c1d2 e8g8 f1d3 b8c6 e5c6 b7c6
info depth 20 seldepth 31 multipv 1 score cp 36 wdl 112 871 17 nodes 1741610 nps 2063518 hashfull 589 tbhits 0 time 844 pv e2e4 e7e6 d2d4 d7d5 b1d2 c7c5 g1f3 g8f6 e4d5 e6d5 f1b5 c8d7 b5d7 b8d7 e1g1 f8e7 d4c5 d7c5 f1e1 e8g8 d2b3 c5b3 a2b3 a7a5
info depth 21 seldepth 30 multipv 1 score cp 33 wdl 105 877 18 nodes 2384536 nps 2062747 hashfull 733 tbhits 0 time 1156 pv e2e4 e7e6 d2d4 d7d5 b1d2 c7c5 e4d5 e6d5 f1b5 c8d7 b5d7 b8d7 g1f3 d8e7 d1e2 e8c8 d4c5 e7e2 e1e2 d8e8 e2f1 f8c5 d2b3 g8f6 b3c5
info depth 22 seldepth 31 multipv 1 score cp 35 wdl 110 873 17 nodes 4017257 nps 2040252 hashfull 919 tbhits 0 time 1969 pv e2e4 c7c5 g1f3 d7d6 f1b5 b8d7 e1g1 a7a6 b5d7 c8d7 f1e1 g8f6 c2c3 e7e6 d2d4 c5d4 c3d4 f8e7 b1c3 e8g8 d4d5 b7b5
info depth 23 seldepth 31 multipv 1 score cp 37 wdl 114 869 17 nodes 4779844 nps 2039182 hashfull 959 tbhits 0 time 2344 pv e2e4 c7c5 g1f3 d7d6 f1b5 c8d7 b5d7 b8d7 e1g1 e7e6 d1e2 f8e7 d2d4 c5d4 f3d4 g8f6 c2c4 e8g8 b2b3 a7a6 g1h1 d8c7 b1c3
info depth 24 currmove d2d4 currmovenumber 2
info depth 24 currmove g1f3 currmovenumber 3
info depth 24 currmove b1c3 currmovenumber 4
info depth 24 currmove c2c3 currmovenumber 5
info depth 24 currmove c2c4 currmovenumber 6
info depth 24 currmove e2e3 currmovenumber 7
info depth 24 currmove d2d3 currmovenumber 8
info depth 24 currmove b2b4 currmovenumber 9
info depth 24 currmove b1a3 currmovenumber 10
info depth 24 currmove h2h4 currmovenumber 11
info depth 24 currmove f2f3 currmovenumber 12
info depth 24 currmove g2g3 currmovenumber 13
info depth 24 currmove a2a4 currmovenumber 14
info depth 24 currmove a2a3 currmovenumber 15
info depth 24 currmove f2f4 currmovenumber 16
info depth 24 currmove g2g4 currmovenumber 17
info depth 24 currmove g1h3 currmovenumber 18
info depth 24 currmove h2h3 currmovenumber 19
info depth 24 currmove b2b3 currmovenumber 20
info depth 24 seldepth 33 multipv 1 score cp 31 upperbound wdl 99 882 19 nodes 5405732 nps 2023103 hashfull 979 tbhits 0 time 2672 pv e2e4 e7e6
info depth 24 currmove e2e4 currmovenumber 1
info depth 24 currmove d2d4 currmovenumber 2
info depth 24 currmove g1f3 currmovenumber 3
info depth 24 currmove b2b4 currmovenumber 4
info depth 24 currmove e2e3 currmovenumber 5
info depth 24 currmove b1c3 currmovenumber 6
info depth 24 currmove c2c4 currmovenumber 7
info depth 24 currmove d2d3 currmovenumber 8
info depth 24 currmove b1a3 currmovenumber 9
info depth 24 currmove c2c3 currmovenumber 10
info depth 24 currmove h2h3 currmovenumber 11
info depth 24 currmove f2f4 currmovenumber 12
info depth 24 currmove a2a3 currmovenumber 13
info depth 24 currmove h2h4 currmovenumber 14
info depth 24 currmove g2g4 currmovenumber 15
info depth 24 currmove a2a4 currmovenumber 16
info depth 24 currmove g2g3 currmovenumber 17
info depth 24 currmove f2f3 currmovenumber 18
info depth 24 currmove g1h3 currmovenumber 19
info depth 24 currmove b2b3 currmovenumber 20
info depth 24 seldepth 33 multipv 1 score cp 26 wdl 88 890 22 nodes 6229276 nps 2023806 hashfull 989 tbhits 0 time 3078 pv e2e4 e7e6 d2d4 d7d5 e4e5 c7c5 c2c3 c8d7 g1f3 b8c6 f1e2 g8e7 e1g1 c5d4 c3d4 e7f5 b1c3 a8c8 c1f4 f8e7 d1d2 d8b6 a1d1 h7h6 f1e1 e8g8
bestmove e2e4 ponder e7e6

The Shuffle chess engine showed similar behaviour, the reason was incorrectly processing inputs.

Gabor Szots
CCRL

@jhonnold
Copy link
Owner

Interesting, I haven't touched my UCI code in a long time. I'll take a look and get back to you.

@jhonnold
Copy link
Owner

I've been able to reproduce your issue.

I compiled these binaries using clang-17 within clang64 MSYS2. Compiling these natively in Windows with gcc-13 results in the issue going away. I don't have an explanation as to why, but I've re-uploaded the binaries.

Feel free to close this issue if you see the issue go away too.

@SzotsGabor
Copy link
Author

SzotsGabor commented Oct 26, 2023

I've been able to reproduce your issue.

I compiled these binaries using clang-17 within clang64 MSYS2. Compiling these natively in Windows with gcc-13 results in the issue going away. I don't have an explanation as to why, but I've re-uploaded the binaries.

Feel free to close this issue if you see the issue go away too.

Sorry Jay, nothing's changed.

BTW, version 11.1 does the same (as expected). And under a GUI such as Cute Chess the engine plays OK.

Here is another snippet how it is here:
uci
a
id name Berserk 12
id author Jay Honnold
option name Hash type spin default 16 min 2 max 131072
option name Threads type spin default 1 min 1 max 256
option name SyzygyPath type string default
option name MultiPV type spin default 1 min 1 max 256
option name Ponder type check default false
option name UCI_ShowWDL type check default true
option name UCI_Chess960 type check default false
option name MoveOverhead type spin default 300 min 100 max 10000
option name Contempt type spin default 0 min -100 max 100
option name EvalFile type string default
uciok
position startpos
a
go depth 15
a
info string time -1 start 1290566453 alloc 0 max 2147483647 depth 15 timeset 0 searchmoves 0
info depth 1 seldepth 1 multipv 1 score cp 52 wdl 164 825 11 nodes 24 nps 24000 hashfull 0 tbhits 0 time 1 pv d2d4
info depth 2 seldepth 2 multipv 1 score cp 75 wdl 271 723 6 nodes 47 nps 47000 hashfull 0 tbhits 0 time 1 pv d2d4 a7a6
info depth 3 seldepth 3 multipv 1 score cp 83 wdl 315 680 5 nodes 82 nps 82000 hashfull 0 tbhits 0 time 1 pv c2c4 a7a6
info depth 4 seldepth 4 multipv 1 score cp 58 wdl 187 804 9 nodes 137 nps 137000 hashfull 0 tbhits 0 time 1 pv c2c4 a7a6 a2a3
info depth 5 seldepth 5 multipv 1 score cp 92 wdl 367 629 4 nodes 397 nps 397000 hashfull 0 tbhits 0 time 1 pv e2e4
info depth 6 seldepth 6 multipv 1 score cp 85 wdl 327 669 4 nodes 704 nps 704000 hashfull 0 tbhits 0 time 1 pv e2e4 c7c5 g1f3 g7g6 d2d4
info depth 7 seldepth 8 multipv 1 score cp 53 wdl 167 822 11 nodes 2254 nps 2254000 hashfull 0 tbhits 0 time 1 pv d2d4 g8f6 g1f3 d7d5 c2c4 d5c4
info depth 8 seldepth 9 multipv 1 score cp 49 wdl 152 836 12 nodes 4123 nps 4123000 hashfull 1 tbhits 0 time 1 pv e2e4 c7c5 g1f3 e7e6 b1c3 b8c6 d2d4 c5d4 f3d4
info depth 9 seldepth 12 multipv 1 score cp 57 wdl 182 808 10 nodes 9309 nps 9309000 hashfull 3 tbhits 0 time 1 pv e2e4 e7e5 g1f3 g8f6 f3e5 f6e4
info depth 10 seldepth 12 multipv 1 score cp 53 wdl 169 820 11 nodes 13525 nps 901666 hashfull 5 tbhits 0 time 15 pv e2e4 c7c5 g1f3 e7e6 f1e2 b8c6 c2c3 g8f6 e4e5 f6d5 e1g1 f8e7
info depth 11 seldepth 15 multipv 1 score cp 47 wdl 146 841 13 nodes 28863 nps 1924200 hashfull 12 tbhits 0 time 15 pv e2e4 e7e6 d2d4 d7d5 b1d2 c7c5 e4d5 e6d5 g1f3 b8c6 f1b5 d8e7
info depth 12 seldepth 16 multipv 1 score cp 48 wdl 150 838 12 nodes 37668 nps 1215096 hashfull 15 tbhits 0 time 31 pv e2e4 e7e6 g1f3 d7d5 e4e5 c7c5 c2c3 b8c6 d2d4 d8b6 f1e2 c8d7 e1g1 c5d4 c3d4
info depth 13 seldepth 18 multipv 1 score cp 48 wdl 150 838 12 nodes 67931 nps 1445340 hashfull 25 tbhits 0 time 47 pv e2e4 e7e6 d2d4 d7d5 b1d2 c7c5 g1f3 g8f6 e4e5 f6d7 c2c3 b8c6 f1d3 f8e7 e1g1 c5d4
info depth 14 seldepth 22 multipv 1 score cp 45 wdl 139 848 13 nodes 104001 nps 1677435 hashfull 38 tbhits 0 time 62 pv e2e4 e7e6 d2d4 d7d5 e4e5 c7c5 c2c3 d8b6 g1f3 b8c6 f1e2 c8d7 e1g1 c5d4
info depth 15 seldepth 23 multipv 1 score cp 38 wdl 117 867 16 nodes 166982 nps 1795505 hashfull 60 tbhits 0 time 93 pv e2e4 e7e6 d2d4 d7d5 e4e5 c7c5 c2c3 d8a5 d4c5 a5c7 b2b4 c7e5 f1e2 e5c7 g1f3 g8f6
bestmove e2e4 ponder e7e6

So every time I type a command I have to type some character to make the engine execute it.

@jhonnold
Copy link
Owner

Are you using a special prompt? I've tested these binaries in Window Terminal, CMD, Git Bash, and MSYS2 clang64. I cannot create the above issue you're mentioning anymore.

@SzotsGabor
Copy link
Author

Are you using a special prompt? I've tested these binaries in Window Terminal, CMD, Git Bash, and MSYS2 clang64. I cannot create the above issue you're mentioning anymore.

I'm afraid I don't know what you mean by special prompt. I started the engine under Windows File Manager and Total Commander and both did the same.
I have asked Ray to check if it is OK with him now.

Anyway, we could live with this issue for years (I have just noticed it exists at all), so no big deal. I may ask Shuffle author what he did to get rid of it.

@jhonnold
Copy link
Owner

I would appreciate that. Sorry for the issues.

@SzotsGabor
Copy link
Author

SzotsGabor commented Oct 26, 2023

This is what Arjun Basandrai, Shuffle author has written to me:

"In my case the error was caused by a line at the beginning of the uci loop that set the stdin buffer to NULL.

I see that in Berserk's code also, in uci.c on Line 286, (setbuf(stdin, NULL);) is added which must be causing the issue. Kindly ask the author to remove this line entirely and see if it fixes the issue."

I removed that line and it indeed helped!

@jhonnold
Copy link
Owner

I'll remove that line, but I don't think there is a need to update the binaries since they're okay within GUIs for now.

@SzotsGabor
Copy link
Author

I'll remove that line, but I don't think there is a need to update the binaries since they're okay within GUIs for now.

That's fine with me.

@jhonnold
Copy link
Owner

jhonnold commented Nov 1, 2023

Fixed in #520

@jhonnold jhonnold closed this as completed Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants