Just added a sampling feature to generate training data (= position + search result), fast and scalably (concurrency supported). This can be used to to teach a neural network to evaluate chess positions.
https://github.com/lucasart/c-chess-cli/#sampling
Hopefully some people will be interested in designing and training their own NN eval, rather than copy/pasting NNUE into their engine.
c-chess-cli
Moderator: Ras
-
lucasart
- Posts: 3243
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
c-chess-cli: generating training data for NN eval
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
-
Roland Chastain
- Posts: 705
- Joined: Sat Jun 08, 2013 10:07 am
- Location: France
- Full name: Roland Chastain
Re: c-chess-cli
Very interesting project.
I have just made a first quick test. One engine doesn't find its opening book, and this results in the following problem:
I wonder why "readyok" is stuck to the error message.
But the first problem (I believe) is that c-chess-cli doesn't seem to change current directory. Am I wrong?
I have just made a first quick test. One engine doesn't find its opening book, and this results in the following problem:
Code: Select all
SlowChess Blitz Classic 2.1 <- ucinewgame
deadline set: SlowChess Blitz Classic 2.1 must respond by 55389187
SlowChess Blitz Classic 2.1 <- isready
SlowChess Blitz Classic 2.1 -> Error Error Loading Book openingBook/TestBook.scbreadyok
deadline passed: SlowChess Blitz Classic 2.1 responded at 55388281, 906ms before the deadline.
deadline passed: SlowChess Blitz Classic 2.1 responded at 55388381, 806ms before the deadline.
deadline passed: SlowChess Blitz Classic 2.1 responded at 55388481, 706ms before the deadline.But the first problem (I believe) is that c-chess-cli doesn't seem to change current directory. Am I wrong?
-
lucasart
- Posts: 3243
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: c-chess-cli
Indeed, it doesn't change the current directory. So the path you give "openingBook/TestBook.scb" has to be either absolute, or relative to the current directory. I could make engine engine use their own directory as current directory, which is probably what users expect.Roland Chastain wrote: ↑Fri Aug 21, 2020 9:39 am Very interesting project.
I have just made a first quick test. One engine doesn't find its opening book, and this results in the following problem:
I wonder why "readyok" is stuck to the error message.Code: Select all
SlowChess Blitz Classic 2.1 <- ucinewgame deadline set: SlowChess Blitz Classic 2.1 must respond by 55389187 SlowChess Blitz Classic 2.1 <- isready SlowChess Blitz Classic 2.1 -> Error Error Loading Book openingBook/TestBook.scbreadyok deadline passed: SlowChess Blitz Classic 2.1 responded at 55388281, 906ms before the deadline. deadline passed: SlowChess Blitz Classic 2.1 responded at 55388381, 806ms before the deadline. deadline passed: SlowChess Blitz Classic 2.1 responded at 55388481, 706ms before the deadline.
But the first problem (I believe) is that c-chess-cli doesn't seem to change current directory. Am I wrong?
The fact that readyok is stuck to the error msg is not related to c-chess-cli, but rather SlowChessBlitz, which forgot to write a '\n' there.
The "deadline passed" is probably a poor choice of words. It's "passed" as in "pass/fail". Maybe "deadline ok" is better.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
-
Roland Chastain
- Posts: 705
- Joined: Sat Jun 08, 2013 10:07 am
- Location: France
- Full name: Roland Chastain
Re: c-chess-cli
Thank you for your answer. To be perfectly clear, I didn't give the path: it's the engine itself who searches automatically its book. I believe that many engines search books or other files like that, so IMHO it would be a good idea to do what you say (make engine use their own directory as current directory).lucasart wrote: ↑Fri Aug 21, 2020 3:03 pm Indeed, it doesn't change the current directory. So the path you give "openingBook/TestBook.scb" has to be either absolute, or relative to the current directory. I could make engine engine use their own directory as current directory, which is probably what users expect.
Yes, it was also my impression. I should report the bug to the author of SlowChess. Done.
No opinion about that: I don't know well english.
-
lucasart
- Posts: 3243
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: c-chess-cli
There is one little trick to be aware of though. In order to capture the stderr of engines along with stdout, c-chess-cli puts them all in the same file using dup2() system call. This replicates the "2>&1" syntax in bash.
So it is possible that SlowChess wrote the error message in stderr without \n, and also wrote readyok in strdout. Still I think that would be wrong, and stderr messages should end with \n. But it would explain why this happens in c-chess-cli and not other tools that discard stderr.
I also fixed the current directory, deducing it from the command. Users with special needs may want to enter it as input parameter for each engine, but at least normal users will be satisfied with the default behavior.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
-
Roland Chastain
- Posts: 705
- Joined: Sat Jun 08, 2013 10:07 am
- Location: France
- Full name: Roland Chastain
Re: c-chess-cli
Indeed.lucasart wrote: ↑Sat Aug 22, 2020 7:30 am There is one little trick to be aware of though. In order to capture the stderr of engines along with stdout, c-chess-cli puts them all in the same file using dup2() system call. This replicates the "2>&1" syntax in bash.
So it is possible that SlowChess wrote the error message in stderr without \n, and also wrote readyok in strdout. Still I think that would be wrong, and stderr messages should end with \n. But it would explain why this happens in c-chess-cli and not other tools that discard stderr.
Perfect, thank you. I will test it.
-
lucasart
- Posts: 3243
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: c-chess-cli
Actually, this will break something that worked before...
What if the user enters a string value containing spaces (using proper syntax to escape spaces in the shell), like so: "python ./engine.py" ?
The new logic of reading the current working directory, as everything before the last "/", results in cwd = "python .", which is not a valid directory...
A simple (but wrong) solution would be to read the first token, separated by " ", and apply the logic of the last "/" to that. Unfortunately, spaces are allowed in file names (and in directory names too, since directories are files as well).
Road to hell is paved with good intentions
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
-
Roland Chastain
- Posts: 705
- Joined: Sat Jun 08, 2013 10:07 am
- Location: France
- Full name: Roland Chastain
Re: c-chess-cli
Indeed. I did not think about that. Maybe you could make an option for directory? This is what other software do.lucasart wrote: ↑Sun Aug 23, 2020 3:31 am Actually, this will break something that worked before...
What if the user enters a string value containing spaces (using proper syntax to escape spaces in the shell), like so: "python ./engine.py" ?
The new logic of reading the current working directory, as everything before the last "/", results in cwd = "python .", which is not a valid directory...
Good luck in finding a solution!
-
lucasart
- Posts: 3243
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: c-chess-cli
I had to reinvent the shell a little:Roland Chastain wrote: ↑Sun Aug 23, 2020 6:05 pmIndeed. I did not think about that. Maybe you could make an option for directory? This is what other software do.lucasart wrote: ↑Sun Aug 23, 2020 3:31 am Actually, this will break something that worked before...
What if the user enters a string value containing spaces (using proper syntax to escape spaces in the shell), like so: "python ./engine.py" ?
The new logic of reading the current working directory, as everything before the last "/", results in cwd = "python .", which is not a valid directory...
Good luck in finding a solution!![]()
- 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").
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
-
OliverBr
- Posts: 865
- Joined: Tue Dec 18, 2007 9:38 pm
- Location: Munich, Germany
- Full name: Dr. Oliver Brausch
Re: c-chess-cli
@lucasart,
thank you!
It would nice to support xboard protocol, too.
What about the handling when an ending crashes? cutechess-cli abort the tourney which can be very annoying, on the other hand you must fix bug, which is got.
Which format is pgn? I like "pgnout min" in cutechess, but is misses the "Time Control" tag.
thank you!
It would nice to support xboard protocol, too.
What about the handling when an ending crashes? cutechess-cli abort the tourney which can be very annoying, on the other hand you must fix bug, which is got.
Which format is pgn? I like "pgnout min" in cutechess, but is misses the "Time Control" tag.
OliThink GitHub: https://github.com/olithink
Nice arcticle about OlIThink: https://www.chessengeria.eu/post/olithink-oldie-goldie
Chess Engine OliThink Homepage: http://brausch.org/home/chess
Nice arcticle about OlIThink: https://www.chessengeria.eu/post/olithink-oldie-goldie
Chess Engine OliThink Homepage: http://brausch.org/home/chess