chess - how to communicate with uci protocol using matlab -


i'm looking method communicate chess engine uci protocol using matlab. chess engine rybka , exe file. when run rybka.exe, can communicate via dos command prompt want via matlab. think have use streampipe , stdin , stdout don't know how use it.

i found code in python , works fine i'm looking matlab version:

import subprocess, time  engine = subprocess.popen(     'a.exe',     universal_newlines=true,     stdin=subprocess.pipe,     stdout=subprocess.pipe, )  def put(command):     print('\nyou:\n\t'+command)     engine.stdin.write(command+'\n')  def get():     # using 'isready' command (engine has answer 'readyok')     # indicate current last line of stdout     engine.stdin.write('isready\n')     print('\nengine:')     while true:         text = engine.stdout.readline().strip()         if text == 'readyok':             break         if text !='':             print('\t'+text) 

if it's case of using exe file , capturing output can use system command capture output. example can run system's dir command in following way:

>> [~, output] = system('dir')  output =  ant      ant.cmd  antrun.bat  antenv.cmd           envset.cmd  runant.pl ant.bat  antrun   antrun.pl   complete-ant-cmd.pl  lcp.bat     runant.py 

documentation: http://www.mathworks.com/help/matlab/ref/system.html

see also: running c program's executable matlab , getting output


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -