Call an engine from BASIC?!

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

JBNielsen
Posts: 267
Joined: Thu Jul 07, 2011 10:31 pm
Location: Denmark

Call an engine from BASIC?!

Post by JBNielsen »

Is it possible to call an engine (fx stockfish) from a compiled QB64 basic-program with the [url]https://www.qb64.org/wiki/CHAIN command?
I want the positions in a game analysed for x seconds and get the score and the main line in return.
User avatar
Deberger
Posts: 91
Joined: Sat Nov 02, 2019 6:42 pm
Full name: ɹǝƃɹǝqǝᗡ ǝɔnɹꓭ

Re: Call an engine from BASIC?!

Post by Deberger »

JBNielsen
Posts: 267
Joined: Thu Jul 07, 2011 10:31 pm
Location: Denmark

Re: Call an engine from BASIC?!

Post by JBNielsen »

Deberger wrote: Sun May 24, 2020 7:36 pm http://www.qb64.org/wiki/SHELL
Thanks.
So you think it is possible with SHELL?!
Do you know what the parameters should look like?
Or where I can read about it?
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Call an engine from BASIC?!

Post by Dann Corbit »

The link he gave is the manual page.
It includes syntax and example code.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Call an engine from BASIC?!

Post by mar »

Deberger wrote: Sun May 24, 2020 7:36 pm http://www.qb64.org/wiki/SHELL
but how does it help you loading and communicating with an engine?
you need to create a new process for the engine, setup pipes so that you can communicate with it. depending on what you actually need, it may be a good idea to have a thread for blocking reads to be able to process engine output in the background etc.
executing engine binary itself won't help, unless you can tell it to do something via commandline. if you need more commands, this would be horribly inefficient
Martin Sedlak
JBNielsen
Posts: 267
Joined: Thu Jul 07, 2011 10:31 pm
Location: Denmark

Re: Call an engine from BASIC?!

Post by JBNielsen »

Dann Corbit wrote: Sun May 24, 2020 9:12 pm The link he gave is the manual page.
It includes syntax and example code.
Thanks; I know.

But I don't know what Stockfish requires to communicate.
JBNielsen
Posts: 267
Joined: Thu Jul 07, 2011 10:31 pm
Location: Denmark

Re: Call an engine from BASIC?!

Post by JBNielsen »

mar wrote: Sun May 24, 2020 10:57 pm
Deberger wrote: Sun May 24, 2020 7:36 pm http://www.qb64.org/wiki/SHELL
but how does it help you loading and communicating with an engine?
you need to create a new process for the engine, setup pipes so that you can communicate with it. depending on what you actually need, it may be a good idea to have a thread for blocking reads to be able to process engine output in the background etc.
executing engine binary itself won't help, unless you can tell it to do something via commandline. if you need more commands, this would be horribly inefficient
I would like to put this function into a single program:
[url]http://talkchess.com/forum3/viewtopic.p ... 21#p483721
User avatar
Deberger
Posts: 91
Joined: Sat Nov 02, 2019 6:42 pm
Full name: ɹǝƃɹǝqǝᗡ ǝɔnɹꓭ

Re: Call an engine from BASIC?!

Post by Deberger »

JBNielsen wrote: Mon May 25, 2020 12:24 am
Dann Corbit wrote: Sun May 24, 2020 9:12 pm The link he gave is the manual page.
It includes syntax and example code.
Thanks; I know.

But I don't know what Stockfish requires to communicate.
This: https://en.wikipedia.org/wiki/Universal_Chess_Interface
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Call an engine from BASIC?!

Post by Dann Corbit »

You can use the bench command to have Stockfish process one or more EPD records.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
JBNielsen
Posts: 267
Joined: Thu Jul 07, 2011 10:31 pm
Location: Denmark

Re: Call an engine from BASIC?!

Post by JBNielsen »

Dann Corbit wrote: Mon May 25, 2020 2:49 am You can use the bench command to have Stockfish process one or more EPD records.
I have tried it manually and it works fine (though my old SF does not know the 'movetime' parameter).

Thanks; perhaps I can use that.