I have understanding of how chess engines work in theory. I know the algorithms like minimax and alpha beta pruning. I want to develop a UCI compatible chess engine.I know that UCI protocols are these: http://wbec-ridderkerk.nl/html/UCIProtocol.html but I don't quite get how the program is supposed to get those commands and how it is supposed to give result.

As minimal as it maybe, but a working model in a short time to test first is preferred. I'll add features on the go. Any tips are welcome. please guide me, thankyou.

If this is not the right place for this question, please guide me where to ask this.

  • \$\begingroup\$ As the documentation says: "all communication is done via standard input and output with text commands". When you did a basic tutorial in your programming language of choice then you likely already know how to use stdout and stdin, even though you might not realize it. Which programming language are you using to implement your engine? \$\endgroup\$
    – Philipp
    Commented Mar 18, 2018 at 23:59
  • \$\begingroup\$ Stdin, stdout thanks. I'm planning on implementing it in c++ for performance concerns. \$\endgroup\$
    – lazy_maybe
    Commented Mar 19, 2018 at 3:42
  • \$\begingroup\$ It says, the engine must be able to respond whenever a command is given in real time. So I'm supposed to listen for a command and put the searching and evaluation part in background threads? \$\endgroup\$
    – lazy_maybe
    Commented Mar 20, 2018 at 16:31
  • 1
    \$\begingroup\$ Either that, or you make sure you regularly check stdin during your calculation loop. \$\endgroup\$
    – Philipp
    Commented Mar 20, 2018 at 16:33

1 Answer 1


My approach to this was launching the UCI engine process from within my chess engine and opening a read pipe and a write pipe to the process. You can then send and receive text commands to the chess engine using the pipes.

Assuming you are using C or C++ on Windows, you can see an example of this by looking at my project from several years ago: https://sourceforge.net/projects/etherealchess/

It's not the best code and it's probably not even threadsafe, but the AI header and source files demonstrate how to do what I just described (also I'm not sure why someone left a one star review with a positive note, and Sourceforge removed all of the five star reviews that had no comments).

  • \$\begingroup\$ That was helpful. If there is, can you provide the link of the GUI free code so I can understand more easily? C++ console and file I'm familiar with, but GUI will take time, so. Besides, one of the reasons behind UCI compatible engine is to be able to use any GUI. \$\endgroup\$
    – lazy_maybe
    Commented Mar 19, 2018 at 20:39
  • \$\begingroup\$ This is where I setup the pipes and send/receive commands from the UCI process: sourceforge.net/p/etherealchess/code/ci/master/tree/ai.cpp \$\endgroup\$ Commented Mar 22, 2018 at 16:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .