Problem with UCI and Arena

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

metax
Posts: 344
Joined: Wed Sep 23, 2009 5:56 pm
Location: Germany

Problem with UCI and Arena

Post by metax »

I have implemented UCI in my engine because I want to run it under a GUI like Arena. The problem is that, when I start Arena, load the engine and start it, in Arena nothing happens. When I look at the debug file of my engine (which logs the standard input and output of the engine), it seems that Arena tries to communicate with the engine using the Xboard protocol, even though I have set the engine type to UCI in Arena... The logfile looks like this...

Code: Select all

XBOARD
UCI
     id name ChessMind
     id author metax
     uciok
LEVEL 0 1 0
NEW
RANDOM
LEVEL 0 1 0
POST
HARD
EASY
ANALYZE
.
.
ANALYZE
ISREADY
     readyok
.
?
FORCE
QUIT
vladstamate
Posts: 161
Joined: Thu Jan 08, 2009 9:06 pm
Location: San Francisco, USA

Re: Problem with UCI and Arena

Post by vladstamate »

Hi,

There is a bug in Arena that when you add an engine for the first time (via install new engine dialog) and say UCI, for some reason it will go back to <Autodetect>. I usually fix this by going back to Engine Management and setting UCI from Autodetect. Make sure Arena lists UCI next to your engine.

The fact that it sends both XBOARD and UCI to your engine seems to indicate just that, that Arena has your game on Autodetect mode.

Regards,
Vlad.
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Problem with UCI and Arena

Post by hgm »

In that case AUTODETECT is not very successful either... :lol: :lol: :lol:
metax
Posts: 344
Joined: Wed Sep 23, 2009 5:56 pm
Location: Germany

Re: Problem with UCI and Arena

Post by metax »

vladstamate wrote:Hi,

There is a bug in Arena that when you add an engine for the first time (via install new engine dialog) and say UCI, for some reason it will go back to <Autodetect>. I usually fix this by going back to Engine Management and setting UCI from Autodetect. Make sure Arena lists UCI next to your engine.

The fact that it sends both XBOARD and UCI to your engine seems to indicate just that, that Arena has your game on Autodetect mode.

Regards,
Vlad.
Thank you for the hint, but I still have some problems. When I load the engine in Arena, it seems to load very slowly (even if the initializing of the engine itself takes a very short time). Not even name and author of the engine are displayed. When I click "new game" and then "analyze", nothing happens at all, and when I look into the logfile of my engine, it seems that Arena not even sends the "go" respectively "go infinite" command. The logfile looks like this now:

Code: Select all

UCI
     id name ChessMind
     id author metax
     uciok
ISREADY
     readyok
QUIT
I wonder if Arena waits for something even if the engine has sent the identification and the readyok command and thus does not send "go" although I click "Analyze"? Or is there another bug?
tmokonen
Posts: 1296
Joined: Sun Mar 12, 2006 6:46 pm
Location: Kelowna
Full name: Tony Mokonen

Re: Problem with UCI and Arena

Post by tmokonen »

You can use Arena's debug window (F4 key) to view all the I/O that Arena generates and receives, from Arena's point of view. Maybe compare that to your log file and see if there's some sort of difference.
metax
Posts: 344
Joined: Wed Sep 23, 2009 5:56 pm
Location: Germany

Re: Problem with UCI and Arena

Post by metax »

tmokonen wrote:You can use Arena's debug window (F4 key) to view all the I/O that Arena generates and receives, from Arena's point of view. Maybe compare that to your log file and see if there's some sort of difference.
OK, there _is_ a difference. ChessMind logs all the input and output which I have posted above, but Arena doesn't receive any input?!

So the Arena debug window looks like this:

Code: Select all

10.391*1*Configured Engine 1 Type&#58;   UCI
10.577*1*Engine 1 dir&#58; C&#58;\Users\*\Documents\ChessMind
10.639*1*Engine 1 commandline&#58; C&#58;\Users\*\Documents\ChessMind\ChessMind.exe 
10.702*1*Engine 1 ProcessID&#58; 320
10.874-->1&#58;uci
18.923-->1&#58;isready
And that was it.

But in the UCI engine interface it says:
* all communication is done via standard input and output with text commands
And if I start the engine manually and try to simulate some UCI traffic, that's no problem:

Code: Select all

UCI
     id name ChessMind
     id author metax
     uciok
ISREADY
     readyok
UCINEWGAME
ISREADY
     readyok
GO INFINITE
     info depth 1
     info score cp 12 depth 1 seldepth 1 time 0 pv b1a3
     info score cp 16 depth 1 seldepth 1 time 0 pv b1c3
     info score cp 24 depth 1 seldepth 1 time 0 pv c2c4
     info depth 2
     info score cp -4 depth 2 seldepth 3 time 0 pv c2c4 c7c5
     info depth 3
     info score cp 16 depth 3 seldepth 5 time 0 pv c2c4 c7c5 b1c3
     info depth 4
     info score cp -4 depth 4 seldepth 7 time 0 pv c2c4 c7c5 b1c3 b8c6
     info score cp 0 depth 4 seldepth 7 time 0 pv b1c3 c7c5
     info score cp 4 depth 4 seldepth 10 time 0 pv d2d4 d7d5
     info depth 5
     info score cp -10 depth 5 seldepth 7 time 0 pv d2d4 d7d5 c1d2 c8d7
     info score cp -2 depth 5 seldepth 8 time 0 pv b1c3 d7d5 e2e4 c7c6
     info score cp 0 depth 5 seldepth 8 time 0 pv g1f3 d7d5
     info score cp 4 depth 5 seldepth 8 time 0 pv e2e4
     info depth 6
     info score cp 21 depth 6 seldepth 12 time 0 pv e2e4 b8c6 b1a3 d7d5 e4d5 d8d5
     info depth 7
     info score cp 3 depth 7 seldepth 13 time 0 pv e2e4 e7e5 f1e2 d8g5 e2f1 f8e7
     info depth 8
     info score cp 31 depth 8 seldepth 16 time 0 pv e2e4 c7c5 f1c4 g8f6 e4e5 d7d5 c4e2
     info depth 9
     info score cp 0 depth 9 seldepth 18 time 1000 pv e2e4 e7e5 f1e2 g8f6 b1c3 f8e7 g1f3 b8c6
     info score cp 4 depth 9 seldepth 18 time 1000 pv c2c4 c7c5 b1c3 b8c6 g1f3 c6a5 c3e4 g8h6 e4c5
     info depth 10
     info score cp 15 depth 10 seldepth 20 time 3000 pv c2c4 c7c5 b1c3 b8c6 g1f3 g8f6 a1b1 f6g4
     info score cp 28 depth 10 seldepth 20 time 5000 pv e2e4 c7c5 b1c3 b8c6 g1f3 g8f6 f1e2 c6b4
     info depth 11
     info score cp 12 depth 11 seldepth 23 time 15000 pv e2e4 c7c5 b1c3 b8c6 g1f3 g8f6 f1c4 c6d4 f3d4 c5d4
     info depth 12
QUIT
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: Problem with UCI and Arena

Post by rvida »

Hi,

try to flush output after writing a line:

Code: Select all

fflush&#40;stdout&#41;;
Or use unbuffered IO:

Code: Select all

setvbuf&#40;stdout, NULL, _IONBF, 0&#41;;
setvbuf&#40;stdin, NULL, _IONBF, 0&#41;;
metax
Posts: 344
Joined: Wed Sep 23, 2009 5:56 pm
Location: Germany

Re: Problem with UCI and Arena

Post by metax »

Thanks a lot! That saved my day! :)
Christopher Conkie
Posts: 6073
Joined: Sat Apr 01, 2006 9:34 pm
Location: Scotland

Re: Problem with UCI and Arena

Post by Christopher Conkie »

vladstamate wrote:Hi,

There is a bug in Arena that when you add an engine for the first time (via install new engine dialog) and say UCI, for some reason it will go back to <Autodetect>. I usually fix this by going back to Engine Management and setting UCI from Autodetect. Make sure Arena lists UCI next to your engine.
Yes there is bug in that method. I always go to Engine Management->Details->New to install a new engine. Then the setting is remembered first time, every time.

Christopher
Christopher Conkie
Posts: 6073
Joined: Sat Apr 01, 2006 9:34 pm
Location: Scotland

Re: Problem with UCI and Arena

Post by Christopher Conkie »

hgm wrote:In that case AUTODETECT is not very successful either... :lol: :lol: :lol:
Autodetect works fine here.

Is there any intuitive way to install engines in Winboard?

I autodetect there is n't.

;-)

Christopher