UCI protocol not working
UCI protocol not working
I've implemented almost all of the important uci commands into my chess program being written in C++. But whenever I try to launch my program with scid, scid just says that my program terminated with exit code 0. This also happens in ExaChess. If I run my program from terminal then this is a sample of what happens (Bold is what my engine is saying, not bold is what I have typed):
uci
id name PROGRAM_NAME 1.0
id author MY_NAME
uciok
isready
readyok
position startpos
go wtime 100000 btime 100000 winc 1000 binc 1000
info depth 2 nodes 388
info depth 3 nodes 7357
info depth 4 nodes 13987
info depth 5 nodes 192952
stop
bestmove e2e4 ponder e7e5
Also, any command that is sent to my engine that it doesn't recognize, it just ignores. My engine recognizes all "position" and "go" commands.
uci
id name PROGRAM_NAME 1.0
id author MY_NAME
uciok
isready
readyok
position startpos
go wtime 100000 btime 100000 winc 1000 binc 1000
info depth 2 nodes 388
info depth 3 nodes 7357
info depth 4 nodes 13987
info depth 5 nodes 192952
stop
bestmove e2e4 ponder e7e5
Also, any command that is sent to my engine that it doesn't recognize, it just ignores. My engine recognizes all "position" and "go" commands.
-
- Site Admin
- Posts: 1226
- Joined: Wed Jun 09, 2010 7:49 am
- Real Name: Jeremy Bernstein
- Location: Berlin, Germany
- Contact:
Re: UCI protocol not working
Looks like you've done everything correctly, as far as the protocol is concerned. Care to send your uci.cpp so we can see what might be busted at the code level? You are outputting via stdout and not via stderr, I assume.
jb
jb
Re: UCI protocol not working
Ok, here's my uci.cpp file.
- Attachments
-
- Uci.cpp
- (9.48 KiB) Downloaded 352 times
-
- Site Admin
- Posts: 1226
- Joined: Wed Jun 09, 2010 7:49 am
- Real Name: Jeremy Bernstein
- Location: Berlin, Germany
- Contact:
Re: UCI protocol not working
I modified your uci.cpp so that it's a standalone program which just parses tokens and was able to load it in Scid vs. Mac:
Note the "Quiet engine" message -- although it"s not part of the UCI spec, you might want to "puts" an initial copyright line or something on launch, as most engines do. It could be that the apps you are testing with are waiting for a sign of life before they start communicating with the engine and timing out if they don't get one. That would be a non-standard implementation, but it could be de facto what you're missing.
jb
Scid vs. Mac <--> Engine communication log file Engine: testuci Command: /Users/jeremydb/Downloads/testuci Directory: /Applications/Schach/ScidvsMac.app/Contents/MacOS Date: Mon Jan 28 10:45:19 CET 2013 Note: Quiet engine (still no output); sending it initial commands. Scid : uci Engine: id name BREEZE 1.0 Engine: id author Christian Daley Engine: uciok Scid : isready Engine: readyok Scid : position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 Scid : go infinite
Note the "Quiet engine" message -- although it"s not part of the UCI spec, you might want to "puts" an initial copyright line or something on launch, as most engines do. It could be that the apps you are testing with are waiting for a sign of life before they start communicating with the engine and timing out if they don't get one. That would be a non-standard implementation, but it could be de facto what you're missing.
jb
Re: UCI protocol not working
Thank you for looking at my code, I will try adding a copyright statement at the beginning. Also, how did you get that log file of the communications between my engine and scid?
-
- Site Admin
- Posts: 1226
- Joined: Wed Jun 09, 2010 7:49 am
- Real Name: Jeremy Bernstein
- Location: Berlin, Germany
- Contact:
Re: UCI protocol not working
There's a button to show the engine log in the Engine management dialog.CDaley11 wrote:Thank you for looking at my code, I will try adding a copyright statement at the beginning. Also, how did you get that log file of the communications between my engine and scid?
jb
Re: UCI protocol not working
After some more debugging I managed to get my program up and running. I am using scid vs. mac and I am a bit confused on the GUI. I've tried testing stockfish with this as well as my own engine. If I go to the analysis window and simply click "start" on an engine then scid starts the engine and tells it to go infinite. But scid never sends the "stop" command. If I pause the engine then scid will send "stop" but even after stockfish (or my engine) prints out the best move, scid won't make that move on the screen. If I go to Play>Against UCI Engine and choose an engine, it works just fine to play against the engine, except it doesn't display info like depth and nodes searched. How can I get to see this important info when playing against the engines?