c-chess-cli

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: c-chess-cli

Post by Dann Corbit »

I think it could be built on Windows, but you would have to use Cygwin instead of Msys2 because of this:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\c-chess-cli.exe.qG3xyI.ltrans0.ltrans.o:<artificial>:(.text+0x288b): undefined reference to `fork'
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: c-chess-cli

Post by Dann Corbit »

If you want to make something that will not run under Msys2, just remember the adage:
"Put a fork() in her, and she's done."
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: c-chess-cli

Post by lucasart »

Roland Chastain wrote: Tue Aug 25, 2020 10:36 pm
lucasart wrote: Mon Aug 24, 2020 1:54 am I had to reinvent the shell a little:
  • First the a:b syntax reserves the ":" character, which is legal in file names, or command line arguments, so that's no good. Now a and b can contain ":" provided it is escaped "\:".
  • Second, a and b may contain spaces, and to make matters worse, the space character is ambiguous. It can be part of a file name, or actually command line arguments. Again, the solution is to use escape sequence "\ ".
  • Third, c-chess-cli now understands command line arguments for a and b (separated by unescaped spaces).
  • And, of course, I kept the logic of deducing the current working directory from the filename (eg. "../Engines/stockfish" => run "./stockfish" in "../Engines").
I have just done another test (with the latest code from the GitHub repository), without success. Maybe I did something wrong.

Here is my command:

Code: Select all

./c-chess-cli \
-cmd /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux:/home/roland/Applications/Moteurs/alouette-0.1.2-lin64/alouette64 \
-games 2 \
-concurrency 1 \
-repeat \
-tc 2+0.02 \
-pgnout out.pgn \
-debug
And the debug file:

Code: Select all

deadline set: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux must respond by 2982479
/home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux <- uci
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2981578, 901ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2981678, 801ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2981779, 700ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2981879, 600ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2981979, 500ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2982079, 400ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2982179, 300ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2982279, 200ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2982380, 99ms before the deadline.
deadline failed: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2982480, 1ms after the deadline.
I see less informations than previously in the debug file. It was useful IMHO to see the messages exchanged.
You're not going crazy. There is definitely a problem in c-chess-cli, that I have yet to understand...

The simplest reproduction is using Stockfish:

Code: Select all

$ ./c-chess-cli -cmd ../Stockfish/stockfish -depth 1 -debug
[1] could not read from ../Stockfish/stockfish
$ cat ./c-chess-cli.1.log 
deadline set: ../Stockfish/stockfish must respond by 2050726
../Stockfish/stockfish <- uci
../Stockfish/stockfish -> Stockfish 220820 by the Stockfish developers (see AUTHORS file)
deadline ok: ../Stockfish/stockfish responded at 2049825, 901ms before the deadline.
deadline ok: ../Stockfish/stockfish responded at 2049925, 801ms before the deadline.
../Stockfish/stockfish -> Unknown command: 
This is beyond my comprehension at this point. Communication with the engine works, and for proof, we read 2 lines successfully. The only thing sent by c-chess-cli is "uci\n" and that causes SF to respond "Unknown command: " and crash (pipe closed, can't read anymore, not the same as time out). This is absurd, of course, and sending "uci\n" by hand to SF works fine.

No such problem with Ethereal or Demolito for example:

Code: Select all

$ ./c-chess-cli -cmd ../Ethereal/Ethereal -depth 1 -debug
[1] Ethereal 12.28 (PEXT) vs Ethereal 12.28 (PEXT): 1/2-1/2 (3-fold repetition)
Score of Ethereal 12.28 (PEXT) vs Ethereal 12.28 (PEXT): 0 - 0 - 1  [0.500] 1
$ ./c-chess-cli -cmd ../Demolito/demolito -depth 1 -debug
[1] Demolito dev vs Demolito dev: 1-0 (checkmate)
Score of Demolito dev vs Demolito dev: 1 - 0 - 0  [1.000] 1
where everything looks in order:

Code: Select all

deadline set: ../Demolito/demolito must respond by 2208185
../Demolito/demolito <- uci
../Demolito/demolito -> id name Demolito dev
Demolito dev -> id author lucasart
Demolito dev -> option name Contempt type spin default 10 min -100 max 100
Demolito dev -> option name Hash type spin default 2 min 1 max 1048576
Demolito dev -> option name Ponder type check default false
Demolito dev -> option name Threads type spin default 1 min 1 max 256
Demolito dev -> option name Time Buffer type spin default 60 min 0 max 1000
Demolito dev -> option name UCI_Chess960 type check default false
Demolito dev -> uciok
deadline cleared: Demolito dev has no more deadline (was 2208185 previously).
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: c-chess-cli

Post by lucasart »

lucasart wrote: Wed Aug 26, 2020 1:28 am
Roland Chastain wrote: Tue Aug 25, 2020 10:36 pm
lucasart wrote: Mon Aug 24, 2020 1:54 am I had to reinvent the shell a little:
  • First the a:b syntax reserves the ":" character, which is legal in file names, or command line arguments, so that's no good. Now a and b can contain ":" provided it is escaped "\:".
  • Second, a and b may contain spaces, and to make matters worse, the space character is ambiguous. It can be part of a file name, or actually command line arguments. Again, the solution is to use escape sequence "\ ".
  • Third, c-chess-cli now understands command line arguments for a and b (separated by unescaped spaces).
  • And, of course, I kept the logic of deducing the current working directory from the filename (eg. "../Engines/stockfish" => run "./stockfish" in "../Engines").
I have just done another test (with the latest code from the GitHub repository), without success. Maybe I did something wrong.

Here is my command:

Code: Select all

./c-chess-cli \
-cmd /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux:/home/roland/Applications/Moteurs/alouette-0.1.2-lin64/alouette64 \
-games 2 \
-concurrency 1 \
-repeat \
-tc 2+0.02 \
-pgnout out.pgn \
-debug
And the debug file:

Code: Select all

deadline set: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux must respond by 2982479
/home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux <- uci
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2981578, 901ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2981678, 801ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2981779, 700ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2981879, 600ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2981979, 500ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2982079, 400ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2982179, 300ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2982279, 200ms before the deadline.
deadline ok: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2982380, 99ms before the deadline.
deadline failed: /home/roland/Applications/Moteurs/SlowChessClassic-Linux-2.2/slow64_linux responded at 2982480, 1ms after the deadline.
I see less informations than previously in the debug file. It was useful IMHO to see the messages exchanged.
You're not going crazy. There is definitely a problem in c-chess-cli, that I have yet to understand...

The simplest reproduction is using Stockfish:

Code: Select all

$ ./c-chess-cli -cmd ../Stockfish/stockfish -depth 1 -debug
[1] could not read from ../Stockfish/stockfish
$ cat ./c-chess-cli.1.log 
deadline set: ../Stockfish/stockfish must respond by 2050726
../Stockfish/stockfish <- uci
../Stockfish/stockfish -> Stockfish 220820 by the Stockfish developers (see AUTHORS file)
deadline ok: ../Stockfish/stockfish responded at 2049825, 901ms before the deadline.
deadline ok: ../Stockfish/stockfish responded at 2049925, 801ms before the deadline.
../Stockfish/stockfish -> Unknown command: 
This is beyond my comprehension at this point. Communication with the engine works, and for proof, we read 2 lines successfully. The only thing sent by c-chess-cli is "uci\n" and that causes SF to respond "Unknown command: " and crash (pipe closed, can't read anymore, not the same as time out). This is absurd, of course, and sending "uci\n" by hand to SF works fine.

No such problem with Ethereal or Demolito for example:

Code: Select all

$ ./c-chess-cli -cmd ../Ethereal/Ethereal -depth 1 -debug
[1] Ethereal 12.28 (PEXT) vs Ethereal 12.28 (PEXT): 1/2-1/2 (3-fold repetition)
Score of Ethereal 12.28 (PEXT) vs Ethereal 12.28 (PEXT): 0 - 0 - 1  [0.500] 1
$ ./c-chess-cli -cmd ../Demolito/demolito -depth 1 -debug
[1] Demolito dev vs Demolito dev: 1-0 (checkmate)
Score of Demolito dev vs Demolito dev: 1 - 0 - 0  [1.000] 1
where everything looks in order:

Code: Select all

deadline set: ../Demolito/demolito must respond by 2208185
../Demolito/demolito <- uci
../Demolito/demolito -> id name Demolito dev
Demolito dev -> id author lucasart
Demolito dev -> option name Contempt type spin default 10 min -100 max 100
Demolito dev -> option name Hash type spin default 2 min 1 max 1048576
Demolito dev -> option name Ponder type check default false
Demolito dev -> option name Threads type spin default 1 min 1 max 256
Demolito dev -> option name Time Buffer type spin default 60 min 0 max 1000
Demolito dev -> option name UCI_Chess960 type check default false
Demolito dev -> uciok
deadline cleared: Demolito dev has no more deadline (was 2208185 previously).
Fixed.

I was running the programs with no arguments (ie. argc=0 instead of argc=1). This caused problems for some programs (including SF), which -rightfully- expect at least argv[0].
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: c-chess-cli

Post by lucasart »

AndrewGrant wrote: Tue Aug 25, 2020 8:54 pm I personally don't care about crash info. Existence of a crash is enough to send you looking.
Agree that recover from crash is useless, and even harmful, because you get lazy and just tolerate engine crashes by switching on the "-recover" flag. An engine should *never* crash. If it crashes once every 24 hours in local testing on 8 threads, it will crash several times an hour in TCEC conditions, which is of course not acceptable.

The "-recover" feature is for end-users, or perhaps for lazy/incompetent programmers.

c-chess-cli logs can be very useful actually. You can trivially reduce the reproduction steps of a bug to their bare minimum by just looking at the log files (and setting up the right testing conditions to make things reproducible).

Or perhaps you mean that core dumps are useless ? Indeed, I never had to use GDB. They say GDB is the deterance strategy debugger: it works! Instead, I use git bisect, integration tests, assert, clang sanitizers. And that's been enough, so far.
AndrewGrant wrote: Tue Aug 25, 2020 8:54 pm I've quite literally never used Cutechess's tournaments or gauntlet features.
I think it's more for useful for end users than programmers. Anyway, it's trivial to write a Python wrapper to build gauntlets and round-robin.
AndrewGrant wrote: Tue Aug 25, 2020 8:54 pm Does c-chess-cli work if you have a POSIX/pthread based mingw?
pthread is not the problem. that's the trivial part. it's just window-dressing on top of win32 api (pun intended :lol: ). the non-trivial part is the fact that Windows lacks fork()... so there is no choice but rewrite all the fork, dup2, pipe, exec stuff using pure Windows API. I'm neither interested in writing such code, nor have a windows machine to test it, so low prio... PR welcome for those who want to soil their hands with those steaming turds of Win32 API syscalls.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: c-chess-cli

Post by Roland Chastain »

lucasart wrote: Wed Aug 26, 2020 2:44 pm Fixed.

I was running the programs with no arguments (ie. argc=0 instead of argc=1). This caused problems for some programs (including SF), which -rightfully- expect at least argv[0].
Good! Indeed the problem is solved. But there is another problem now. :)

mytest.sh

Code: Select all

./c-chess-cli -cmd /home/roland/Applications/moteurs/slowchess/classic/21/slow64_linux:/home/roland/Applications/moteurs/moustique/03/moustique64 \
-tc 2+0.02 \
-games 2 \
-concurrency 1 \
-pgnout out.pgn \
-debug
mytest.log

Code: Select all

[roland@localhost c-chess-cli]$ sh mytest.sh
[1] SlowChess Blitz Classic 2.1 vs Moustique 0.3: 1-0 (rules infraction)
Score of SlowChess Blitz Classic 2.1 vs Moustique 0.3: 1 - 0 - 0  [1.000] 1
[1] Moustique 0.3 vs SlowChess Blitz Classic 2.1: 0-1 (rules infraction)
Score of SlowChess Blitz Classic 2.1 vs Moustique 0.3: 2 - 0 - 0  [1.000] 2
[roland@localhost c-chess-cli]$ 
c-chess-cli.1.log

Code: Select all

deadline set: /home/roland/Applications/moteurs/slowchess/classic/21/slow64_linux must respond by 1279270
/home/roland/Applications/moteurs/slowchess/classic/21/slow64_linux <- uci
/home/roland/Applications/moteurs/slowchess/classic/21/slow64_linux -> id name SlowChess Blitz Classic 2.1
SlowChess Blitz Classic 2.1 -> id author Jonathan Kreuzer
SlowChess Blitz Classic 2.1 -> option name Hash type spin default 64 min 4 max 16384
SlowChess Blitz Classic 2.1 -> option name Clear Hash type button
SlowChess Blitz Classic 2.1 -> option name Ponder type check
SlowChess Blitz Classic 2.1 -> option name OwnBook type check default true
SlowChess Blitz Classic 2.1 -> option name Debug Log type check default false
SlowChess Blitz Classic 2.1 -> option name UCI_Chess960 type check default false
SlowChess Blitz Classic 2.1 -> option name Save Games type check default false
SlowChess Blitz Classic 2.1 -> option name Threads type spin default 1 min 1 max 256
SlowChess Blitz Classic 2.1 -> option name MultiPV type spin default 1 min 1 max 8
SlowChess Blitz Classic 2.1 -> uciok
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1279270 previously).
deadline set: /home/roland/Applications/moteurs/moustique/03/moustique64 must respond by 1279273
/home/roland/Applications/moteurs/moustique/03/moustique64 <- uci
/home/roland/Applications/moteurs/moustique/03/moustique64 -> id name Moustique 0.3
Moustique 0.3 -> id author Juergen Schlottke, Roland Chastain
Moustique 0.3 -> uciok
deadline cleared: Moustique 0.3 has no more deadline (was 1279273 previously).
SlowChess Blitz Classic 2.1 <- ucinewgame
deadline set: SlowChess Blitz Classic 2.1 must respond by 1279275
SlowChess Blitz Classic 2.1 <- isready
SlowChess Blitz Classic 2.1 -> readyok
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1279275 previously).
Moustique 0.3 <- ucinewgame
deadline set: Moustique 0.3 must respond by 1279327
Moustique 0.3 <- isready
Moustique 0.3 -> readyok
deadline cleared: Moustique 0.3 has no more deadline (was 1279327 previously).
SlowChess Blitz Classic 2.1 <- position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
deadline set: SlowChess Blitz Classic 2.1 must respond by 1279327
SlowChess Blitz Classic 2.1 <- isready
SlowChess Blitz Classic 2.1 -> readyok
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1279327 previously).
SlowChess Blitz Classic 2.1 <- go wtime 2020 winc 20 btime 2000 binc 20
deadline set: SlowChess Blitz Classic 2.1 must respond by 1281347
SlowChess Blitz Classic 2.1 -> 0 3 0                                                                5 e4  
SlowChess Blitz Classic 2.1 -> bestmove e2e4 
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1281347 previously).
Moustique 0.3 <- position fen rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1
deadline set: Moustique 0.3 must respond by 1279334
Moustique 0.3 <- isready
Moustique 0.3 -> readyok
deadline cleared: Moustique 0.3 has no more deadline (was 1279334 previously).
Moustique 0.3 <- go wtime 2013 winc 20 btime 2020 binc 20
deadline set: Moustique 0.3 must respond by 1281354
Moustique 0.3 -> bestmove c7c5
deadline cleared: Moustique 0.3 has no more deadline (was 1281354 previously).
SlowChess Blitz Classic 2.1 <- position fen rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2
deadline set: SlowChess Blitz Classic 2.1 must respond by 1279336
SlowChess Blitz Classic 2.1 <- isready
SlowChess Blitz Classic 2.1 -> readyok
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1279336 previously).
SlowChess Blitz Classic 2.1 <- go wtime 2033 winc 20 btime 2018 binc 20
deadline set: SlowChess Blitz Classic 2.1 must respond by 1281369
SlowChess Blitz Classic 2.1 -> 0 1 0                                                                5 d3  
SlowChess Blitz Classic 2.1 -> bestmove d2d3 
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1281369 previously).
Moustique 0.3 <- position fen rnbqkbnr/pp1ppppp/8/2p5/4P3/3P4/PPP2PPP/RNBQKBNR b KQkq - 0 2
deadline set: Moustique 0.3 must respond by 1279336
Moustique 0.3 <- isready
Moustique 0.3 -> readyok
deadline cleared: Moustique 0.3 has no more deadline (was 1279336 previously).
Moustique 0.3 <- go wtime 2033 winc 20 btime 2038 binc 20
deadline set: Moustique 0.3 must respond by 1281374
deadline ok: Moustique 0.3 responded at 1278370, 3004ms before the deadline.
deadline ok: Moustique 0.3 responded at 1278470, 2904ms before the deadline.
deadline ok: Moustique 0.3 responded at 1278570, 2804ms before the deadline.
Moustique 0.3 -> bestmove b8c6
deadline cleared: Moustique 0.3 has no more deadline (was 1281374 previously).
SlowChess Blitz Classic 2.1 <- position fen rnbqkbnr/pp1ppppp/8/2p5/4P3/3P4/PPP2PPP/RNBQKBNR b KQkq - 0 2 moves b8c6
deadline set: SlowChess Blitz Classic 2.1 must respond by 1279658
SlowChess Blitz Classic 2.1 <- isready
SlowChess Blitz Classic 2.1 -> readyok
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1279658 previously).
SlowChess Blitz Classic 2.1 <- go wtime 2053 winc 20 btime 1716 binc 20
deadline set: SlowChess Blitz Classic 2.1 must respond by 1281711
SlowChess Blitz Classic 2.1 -> 0 1 0                                                                1 g3  
SlowChess Blitz Classic 2.1 -> bestmove g2g3 
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1281711 previously).
Moustique 0.3 <- position fen r1bqkbnr/pp1ppppp/2n5/2p5/4P3/3P2P1/PPP2P1P/RNBQKBNR b KQkq - 0 3
deadline set: Moustique 0.3 must respond by 1279659
Moustique 0.3 <- isready
Moustique 0.3 -> readyok
deadline cleared: Moustique 0.3 has no more deadline (was 1279659 previously).
Moustique 0.3 <- go wtime 2052 winc 20 btime 1736 binc 20
deadline set: Moustique 0.3 must respond by 1281395
Moustique 0.3 -> bestmove g7g6
deadline cleared: Moustique 0.3 has no more deadline (was 1281395 previously).
SlowChess Blitz Classic 2.1 <- position fen r1bqkbnr/pp1ppp1p/2n3p1/2p5/4P3/3P2P1/PPP2P1P/RNBQKBNR w KQkq - 0 4
deadline set: SlowChess Blitz Classic 2.1 must respond by 1279666
SlowChess Blitz Classic 2.1 <- isready
SlowChess Blitz Classic 2.1 -> readyok
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1279666 previously).
SlowChess Blitz Classic 2.1 <- go wtime 2072 winc 20 btime 1730 binc 20
deadline set: SlowChess Blitz Classic 2.1 must respond by 1281738
SlowChess Blitz Classic 2.1 -> 0 1 0                                                                1 Bg2  
SlowChess Blitz Classic 2.1 -> bestmove f1g2 
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1281738 previously).
Moustique 0.3 <- position fen r1bqkbnr/pp1ppp1p/2n3p1/2p5/4P3/3P2P1/PPP2P1P/RNBQKBNR w KQkq - 0 4 moves f1g2
deadline set: Moustique 0.3 must respond by 1279666
Moustique 0.3 <- isready
Moustique 0.3 -> readyok
deadline cleared: Moustique 0.3 has no more deadline (was 1279666 previously).
Moustique 0.3 <- go wtime 2072 winc 20 btime 1750 binc 20
deadline set: Moustique 0.3 must respond by 1281416
Moustique 0.3 -> bestmove f1g2
deadline cleared: Moustique 0.3 has no more deadline (was 1281416 previously).
SlowChess Blitz Classic 2.1 <- ucinewgame
deadline set: SlowChess Blitz Classic 2.1 must respond by 1279668
SlowChess Blitz Classic 2.1 <- isready
SlowChess Blitz Classic 2.1 -> readyok
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1279668 previously).
Moustique 0.3 <- ucinewgame
deadline set: Moustique 0.3 must respond by 1279669
Moustique 0.3 <- isready
Moustique 0.3 -> readyok
deadline cleared: Moustique 0.3 has no more deadline (was 1279669 previously).
Moustique 0.3 <- position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
deadline set: Moustique 0.3 must respond by 1279669
Moustique 0.3 <- isready
Moustique 0.3 -> readyok
deadline cleared: Moustique 0.3 has no more deadline (was 1279669 previously).
Moustique 0.3 <- go wtime 2020 winc 20 btime 2000 binc 20
deadline set: Moustique 0.3 must respond by 1281689
deadline ok: Moustique 0.3 responded at 1278671, 3018ms before the deadline.
Moustique 0.3 -> bestmove e2e4
deadline cleared: Moustique 0.3 has no more deadline (was 1281689 previously).
SlowChess Blitz Classic 2.1 <- position fen rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1
deadline set: SlowChess Blitz Classic 2.1 must respond by 1279672
SlowChess Blitz Classic 2.1 <- isready
SlowChess Blitz Classic 2.1 -> readyok
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1279672 previously).
SlowChess Blitz Classic 2.1 <- go wtime 2018 winc 20 btime 2020 binc 20
deadline set: SlowChess Blitz Classic 2.1 must respond by 1281692
SlowChess Blitz Classic 2.1 -> 0 1 0                                                                7 e6  
SlowChess Blitz Classic 2.1 -> bestmove e7e6 
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1281692 previously).
Moustique 0.3 <- position fen rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2
deadline set: Moustique 0.3 must respond by 1279672
Moustique 0.3 <- isready
Moustique 0.3 -> readyok
deadline cleared: Moustique 0.3 has no more deadline (was 1279672 previously).
Moustique 0.3 <- go wtime 2038 winc 20 btime 2020 binc 20
deadline set: Moustique 0.3 must respond by 1281710
Moustique 0.3 -> bestmove d2d4
deadline cleared: Moustique 0.3 has no more deadline (was 1281710 previously).
SlowChess Blitz Classic 2.1 <- position fen rnbqkbnr/pppp1ppp/4p3/8/3PP3/8/PPP2PPP/RNBQKBNR b KQkq - 0 2
deadline set: SlowChess Blitz Classic 2.1 must respond by 1279675
SlowChess Blitz Classic 2.1 <- isready
SlowChess Blitz Classic 2.1 -> readyok
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1279675 previously).
SlowChess Blitz Classic 2.1 <- go wtime 2036 winc 20 btime 2040 binc 20
deadline set: SlowChess Blitz Classic 2.1 must respond by 1281715
SlowChess Blitz Classic 2.1 -> 0 1 0                                                                1 d5  
SlowChess Blitz Classic 2.1 -> bestmove d7d5 
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1281715 previously).
Moustique 0.3 <- position fen rnbqkbnr/ppp2ppp/4p3/3p4/3PP3/8/PPP2PPP/RNBQKBNR w KQkq - 0 3
deadline set: Moustique 0.3 must respond by 1279675
Moustique 0.3 <- isready
Moustique 0.3 -> readyok
deadline cleared: Moustique 0.3 has no more deadline (was 1279675 previously).
Moustique 0.3 <- go wtime 2056 winc 20 btime 2040 binc 20
deadline set: Moustique 0.3 must respond by 1281731
Moustique 0.3 -> bestmove b1c3
deadline cleared: Moustique 0.3 has no more deadline (was 1281731 previously).
SlowChess Blitz Classic 2.1 <- position fen rnbqkbnr/ppp2ppp/4p3/3p4/3PP3/8/PPP2PPP/RNBQKBNR w KQkq - 0 3 moves b1c3
deadline set: SlowChess Blitz Classic 2.1 must respond by 1279677
SlowChess Blitz Classic 2.1 <- isready
SlowChess Blitz Classic 2.1 -> readyok
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1279677 previously).
SlowChess Blitz Classic 2.1 <- go wtime 2054 winc 20 btime 2060 binc 20
deadline set: SlowChess Blitz Classic 2.1 must respond by 1281737
SlowChess Blitz Classic 2.1 -> 0 1 0                                                                3 Nf6  
SlowChess Blitz Classic 2.1 -> bestmove g8f6 
deadline cleared: SlowChess Blitz Classic 2.1 has no more deadline (was 1281737 previously).
Moustique 0.3 <- position fen rnbqkbnr/ppp2ppp/4p3/3p4/3PP3/8/PPP2PPP/RNBQKBNR w KQkq - 0 3 moves b1c3 g8f6
deadline set: Moustique 0.3 must respond by 1279677
Moustique 0.3 <- isready
Moustique 0.3 -> readyok
deadline cleared: Moustique 0.3 has no more deadline (was 1279677 previously).
Moustique 0.3 <- go wtime 2074 winc 20 btime 2060 binc 20
deadline set: Moustique 0.3 must respond by 1281751
Moustique 0.3 -> bestmove b1c3
deadline cleared: Moustique 0.3 has no more deadline (was 1281751 previously).
out.pgn

Code: Select all

[White "SlowChess Blitz Classic 2.1"]
[Black "Moustique 0.3"]
[Result "1-0"]
[Termination "rules infraction"]
[FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"]
[PlyCount "7"]

1. e4 c5 2. d3 Nc6 3. g3 g6 4. Bg2 1-0

[White "Moustique 0.3"]
[Black "SlowChess Blitz Classic 2.1"]
[Result "0-1"]
[Termination "rules infraction"]
[FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"]
[PlyCount "6"]

1. e4 e6 2. d4 d5 3. Nc3 Nf6 0-1
No idea of what the infraction is. :?
Qui trop embrasse mal étreint.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: c-chess-cli

Post by lucasart »

Roland Chastain wrote: Wed Aug 26, 2020 8:30 pm No idea of what the infraction is. :?
Illegal move by Moustique. Black receives the position after f1g2, and plays f1g2 itself ?

Code: Select all

Moustique 0.3 <- position fen r1bqkbnr/pp1ppp1p/2n3p1/2p5/4P3/3P2P1/PPP2P1P/RNBQKBNR w KQkq - 0 4 moves f1g2
Moustique 0.3 <- go wtime 2072 winc 20 btime 1750 binc 20
Moustique 0.3 -> bestmove f1g2
Same problem in the second game

Code: Select all

Moustique 0.3 <- position fen rnbqkbnr/ppp2ppp/4p3/3p4/3PP3/8/PPP2PPP/RNBQKBNR w KQkq - 0 3 moves b1c3 g8f6
Moustique 0.3 -> bestmove b1c3
It looks as though Moustique parses "position fen %s" correctly, but discards the " moves %s ..." afterwards.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: c-chess-cli

Post by Roland Chastain »

lucasart wrote: Thu Aug 27, 2020 1:43 am Illegal move by Moustique. Black receives the position after f1g2, and plays f1g2 itself ?
Indeed. Thank you for the explanation.
Qui trop embrasse mal étreint.
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: c-chess-cli

Post by phhnguyen »

OliverBr wrote: Tue Aug 25, 2020 9:20 pm
AndrewGrant wrote: Tue Aug 25, 2020 8:54 pm Xboard is a nightmare. UCI has flaws, but at least its clear.
Not in my opinion. With xboard you don't need an extra thread. The commands integrate very well in the search.
...
Interesting! Do you know why xboard engines can run without extra thread but not UCI ones? Because of “ping” command or something else?

BTW, engines without extra thread for reading input may have not advantages nowadays and they are so laggy on response some commands such as “quit”, isn’t it?
https://banksiagui.com
The most features chess GUI, based on opensource Banksia - the chess tournament manager
OliverBr
Posts: 725
Joined: Tue Dec 18, 2007 9:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch

Re: c-chess-cli

Post by OliverBr »

phhnguyen wrote: Thu Aug 27, 2020 6:47 am
OliverBr wrote: Tue Aug 25, 2020 9:20 pm
AndrewGrant wrote: Tue Aug 25, 2020 8:54 pm Xboard is a nightmare. UCI has flaws, but at least its clear.
Not in my opinion. With xboard you don't need an extra thread. The commands integrate very well in the search.
...
Interesting! Do you know why xboard engines can run without extra thread but not UCI ones? Because of “ping” command or something else?
I don't know much about UCI, but can tell you that OliThink runs on one single thread supporting complete xboard protocol. I read somewhere that the xboard protocol had been designed in this manner.

Its may be "confusing" a little at first glance, but it isn't. I may be a little complicated in implementation, but only that you have to think more, it's not bulking the code.
BTW, engines without extra thread for reading input may have not advantages nowadays and they are so laggy on response some commands such as “quit”, isn’t it?
No, this doesn't have to be. OliThink quits within milliseconds (max. 16k nodes). If an engines lags, it's a problem of that particular engine. There are some laggy engines, it's interrupt notable when I quit a cutechess-cli tourney with concurrency = 32.

PS: The Java version of OliThink uses an extra thread, because I didn't find a method to peek if there has been an input. It should be possible though with an library like Apache Commons and PeekableInputStream.
Last edited by OliverBr on Thu Aug 27, 2020 7:14 am, edited 1 time in total.
Chess Engine OliThink: http://brausch.org/home/chess
OliThink GitHub:https://github.com/olithink