Communicating with XBoard (chess engine) (C++/C)

若如初见. 提交于 2019-12-05 12:03:11
Evgeny Kluev

You are doing it almost right: get a command from XBoard with fgets, then report a move with printf and fflush. (One thing is wrong, though: you don't need to 'print the command to the console/screen'; you are not communicating with the console/screen; you only read commands from XBoard and send moves back to XBoard).

Probably, it would be easier to start with some existing code. Try to read sources for GNU Chess. Or download sources for any other chess engine, supporting XBoard protocol.

And here is other question with lots of information on chess engine programming: "What are some good resources for writing a chess engine?".

Barton Chittenden

I think that you're looking for pipe(), included in unistd.h. Take a look at Can popen() make bidirectional pipes like pipe() + fork()? for notes on implementation.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!