Piping input into an engine

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Ras
Posts: 2703
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Piping input into an engine

Post by Ras »

mvanthoor wrote: Thu Sep 30, 2021 10:28 pmI could make it so that the engine sees the EOF and not react to it until the last command has been completely executed
Which would be a long time in case of "go infinite" and a GUI crash. :wink:
Even though I'm a long-time Linux user myself (and recently fully switched to it on the desktop, finally) who uses the command line extensively, I can't see myself using a chess engine like that.
Chess engines are not meant as CLI tools on their own in the first place. They are modular components of a framework with the engine as backend and a controller as frontend, either a GUI or e.g. a CLI tournament manager. The main difference to actual CLI tools is that stdin/stdout is a two-sided communication protocol, not the input/processing/output model of usual CLI tools. Also, a UCI engine may discard commands other than stop, quit, or isready while searching, which means that you couldn't reliably batch up more than one go command anyway.
Rasmus Althoff
https://www.ct800.net
gflohr
Posts: 57
Joined: Fri Jul 23, 2021 5:24 pm
Location: Elin Pelin
Full name: Guido Flohr

Re: Piping input into an engine

Post by gflohr »

I also wouldn't use an engine inside a terminal for playing chess. But while developing I do it all the time, with my own one and others.

And "my batch mode" is also useful for scripting because you can simply prepare a file with commands instead setting up bi-directional IPC.
User avatar
hgm
Posts: 28396
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Piping input into an engine

Post by hgm »

When I run an engine from the terminal for debugging, I just copy-paste the set of required commands into the terminal.