I guess you have to download and study the uci spec first. AFAIU this protocol
is unusual in that the chess engine do not acknowledge most commands, you just
issue commands to the chess engine, it will not return any result or acknowledge
that the command has been processed. So that you don't have to wait for stdin.
Other commands return a fixed length response such as "ready" so that after
getting these 5 characters you do not need reading further. I guess using
ReadAll is inappropriate, instead it needs a big switch statement for each
command, some commands do not need read, other commands wait for a specific
messages.
JC Coez wrote:
It seems to be exactly what happened in my case wth the Arion chess
engine. When you will have some time to solve that please let me know.
JC Coez
----- Original Message ----- From: "Raul Miller" <[EMAIL PROTECTED]>
To: "Programming forum" <[email protected]>
Sent: Monday, April 02, 2007 9:33 PM
Subject: Re: [Jprogramming] stdin/stdout
I downloaded and installed arasan 9.5 from
http://www.arasanchess.org/downld.html
I ran arasan.exe, and the gui worked.
I ran arasanx.exe, and the stdio interface worked (I was able to enter
commands like
e7e6 and e2e4, and get plausible responses).
In J, I defined:
spawnio=:3 :0
require'task'
cocurrent 'jtask'
'or ow'=.CreatePipe 1
'ir iw'=.CreatePipe 2
ph=.(ow,ir) CreateProcess y
if.1>ph do.
CloseHandle or,ow,ir,iw
assert.0
end.
CloseHandle ow,ir
iw,or
)
arasanx=:3 :0
spawnio (2!:5'APPDATA'),'\arasanx.exe'
)
rd=:ReadAll_jtask_
wr=:WriteAll_jtask_
Then, I tried:
arasanx''
548 424
rd 424
At this point, my J session "froze". I then went to the OS, and ended
the
arasanx process. As soon as I did this, J returned the text of the
first line
from arasanx:
Arasan 9.5 Copyright 1994-2006 by Jon Dart
If I wanted to make this work, I'd have to figure out how to read and
write lines. (task.ijs does not include a ReadLine verb.)
I think I know how to make this work (actually, I have several ideas
I could try), but I don't have time to mess with this right now.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
---------------------------------------------------------------------------------------
Orange vous informe que cet e-mail a ete controle par l'anti-virus
mail. Aucun virus connu a ce jour par nos services n'a ete detecte.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm