R/uci_read.R

Defines functions uci_read

Documented in uci_read

#' Read current stdout from chess engine
#'
#' Read current stdout from chess engine
#'
#' @param engine engine object
#' @return engine object
#'
#' @examples
#'\donttest{
#' # Linux (make sure you have executable permission):
#' engine_path <- "./stockfish_10_x64"
#' # Windows
#' # engine_path <- "./stockfish_10_x64.exe"
#' e <- uci_engine(engine_path)
#' e <- uci_read(e)
#' e$temp
#' uci_quit(e)}
#' @export
uci_read <- function(engine){
  #prs <- process_read(engine$pipe)$stdout subprocess
  prs <- engine$pipe$read_output_lines()
  if(length(prs)>0) engine$temp <- c(engine$temp,prs)
  return(engine)
}
rosawojciech/bigchess documentation built on Jan. 19, 2021, 5:54 a.m.