gui engine communication help needed

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Pierre Bokma
Posts: 31
Joined: Tue Dec 07, 2010 11:19 pm
Location: Holland

gui engine communication help needed

Post by Pierre Bokma »

Hi friends,

In order to boost my activities in developing my chess engine i would like to write my own chess gui. The problem is that i have not been able to let my gui communicate with the engine (UCI). I have studied the source of Tarrash (i gui i like very musch and wich i can recommend to everybody) but i can not figure out how the GUI sends its commands to the engine. Can anybody explain clearly how the gui can communicate with the engien?

thanks in advance :

pierre
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: gui engine communication help needed

Post by ilari »

Could you be more specific about the problem? Which programming language, which application development framework, which operating system, and what have you tried so far?

On a conceptual level it's all pretty simple. The GUI starts the engine application, reads data from its standard output, and sends data to its standard input using pipes. The method for setting up and using the pipes depends on the OS, language, and the framework.

BTW, I took a look at the Tarrash source code. It's not something that aspiring GUI programmers should try to learn from.
Pierre Bokma
Posts: 31
Joined: Tue Dec 07, 2010 11:19 pm
Location: Holland

Re: gui engine communication help needed

Post by Pierre Bokma »

I should have added that i use visual c (although c++ answers are also good) under windows.

Thusfar i have been able to start the engine using createproces.

The next step is to setup pipes ans send commandos to engine. This i have not been able to achieve. I have tried various examples from the net but one one succed.

hope you can help!

Pierre
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: gui engine communication help needed

Post by ilari »

I've been in the same situation with our Cute Chess program. Take a look at the engineprocess_win.cpp file here, especially the start() function: http://repo.or.cz/w/sloppygui.git/blob/ ... ss_win.cpp

Some of the stuff is specific to Nokia's Qt framework, but creating and setting up the pipes, launching the program, etc. are all WINAPI.
Pierre Bokma
Posts: 31
Joined: Tue Dec 07, 2010 11:19 pm
Location: Holland

Re: gui engine communication help needed

Post by Pierre Bokma »

thanks, i will start immediatly and i will post me experiences. I hope can fiend some time in the course of this week to check again. maybe i have further questions. I'am not the greatest programmer in the world.

pierre
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: gui engine communication help needed

Post by ilari »

Oh, I really recommend reading this too: http://msdn.microsoft.com/en-us/library/ms682499
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: gui engine communication help needed

Post by Michel »

And you can also look in the source of polyglot or winboard...
kinderchocolate
Posts: 454
Joined: Mon Nov 01, 2010 6:55 am
Full name: Ted Wong

Re: gui engine communication help needed

Post by kinderchocolate »

I agree polyglot is a better source code to learn form. Anyway, you don't even have to read the source. The protocol is documented, and you can play around by typing the commands manually on a terminal.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: gui engine communication help needed

Post by ilari »

kinderchocolate wrote:I agree polyglot is a better source code to learn form. Anyway, you don't even have to read the source. The protocol is documented, and you can play around by typing the commands manually on a terminal.
Typing commands on a terminal isn't going to help much when you're trying to set up WINAPI pipes between two processes.
Pierre Bokma
Posts: 31
Joined: Tue Dec 07, 2010 11:19 pm
Location: Holland

Re: gui engine communication help needed

Post by Pierre Bokma »

this code is really nice. My gui starts the enigine and is able to close it. So i take it teh gui can send stuff to the engine. Now i'am trying to figure out how to read from the pipe to get messages fro the engine into the gui

regards