[R] open connection to system
Adrian Dușa
dusa.adrian at unibuc.ro
Tue Jul 14 18:45:48 CEST 2015
Dear list,
Probably not the best subject line, but hopefully I can explain.
I would like to use R and open a connection to a (system) command line base
chess engine
(for example, there is an open source one at stockfishchess.org)
In the Terminal window (using MacOS), I can type two commands:
$ ./stockfish-6-64 <-- this is the first command
Stockfish 6 64 by Tord Romstad, Marco Costalba and Joona Kiiski
go movetime 3000 <-- this is the second command
(then lots of lines calculated by the engine, with a final answer after 3
seconds)
First command opens a connection to the chess engine, the seconds one tells
it to search for a move.
The question is, can I do this via R?
I tried the system() command, which works with the first command:
> system("./stockfish-6-64", intern=TRUE)
[1] "Stockfish 6 64 by Tord Romstad, Marco Costalba and Joona Kiiski"
but it closes the connection and returns an error if I attempt the second
command:
> system("./stockfish-6-64\ngo movetime 3000", intern=TRUE)
Error in system("./stockfish-6-64\ngo movetime 3000", intern = TRUE) :
error in running command
sh: line 1: go: command not found
Any hint would be really appreciated, thanks in advance,
Adrian
--
Adrian Dusa
University of Bucharest
Romanian Social Data Archive
Soseaua Panduri nr.90
050663 Bucharest sector 5
Romania
[[alternative HTML version deleted]]
More information about the R-help
mailing list