I´m trying to do my own engine.
I´m reading about UCI-engine communication and found this for example:
isready
...
This command must always be answered with "readyok" and can be sent also when the engine is calculating
in which case the engine should also immediately answer with "readyok" without stopping the search.
How could I do it?
I really do not imagine that I must place a call to UCI-engine communications subroutine each , say, ten lines of code everywhere around the all program
Please could you explain me where I´m wrong?
Or there is in C++* some way to make a kind "hide phantom" all time present subroutine that suddenly turn on when some imput is making?
*: I´m doing it in QBasic, not in C++
I´m trying to do my own engine.
I´m reading about UCI-engine communication and found this for example:
isready
...
This command must always be answered with "readyok" and can be sent also when the engine is calculating
in which case the engine should also immediately answer with "readyok" without stopping the search.
How could I do it?
I really do not imagine that I must place a call to UCI-engine communications subroutine each , say, ten lines of code everywhere around the all program
Please could you explain me where I´m wrong?
Or there is in C++* some way to make a kind "hide phantom" all time present subroutine that suddenly turn on when some imput is making?
*: I´m doing it in QBasic, not in C++
Thnaks!
Just check for input every second or so. If you spot something, read it and handle it.
I´m trying to do my own engine.
I´m reading about UCI-engine communication and found this for example:
isready
...
This command must always be answered with "readyok" and can be sent also when the engine is calculating
in which case the engine should also immediately answer with "readyok" without stopping the search.
How could I do it?
I really do not imagine that I must place a call to UCI-engine communications subroutine each , say, ten lines of code everywhere around the all program
Please could you explain me where I´m wrong?
Or there is in C++* some way to make a kind "hide phantom" all time present subroutine that suddenly turn on when some imput is making?
*: I´m doing it in QBasic, not in C++
Thnaks!
The approach most people take is using a thread to handle IO and nothing else.
It's nice and intuitive, if you are familiar with multi-threading.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
some programmer check the input every X nodes while searching.
if you know approximately nodes/second, you can use it instead of "check every x second"
elcabesa wrote:some programmer check the input every X nodes while searching.
if you know approximately nodes/second, you can use it instead of "check every x second"
Yup, that's what I do. I have a node counter that gets incremented every time you enter quiescence_search or negamax. When this happens in negamax, I also check to see if I have to check for input.
// Somewhere near the beginning of negamax...
++node_count;
if (node_count >= next_check) {
next_check = node_count + 500000; // Schedule the next check
check_input();
check_clock(); // In case we hit the maximum allowed time for this search
}
about using nodes.... then you need UCI is enough flexible or take a great security gap cause if not, if the engine runs in slow computer the GUI could stop the game?
so managing the IO stand for handling the uci protocol
about using nodes
lets suppose your engine do 500kN/s on a modern computer, you can choose to check the IO every 5000 nodes (every 10ms).
if your engine does 100kN/son a slow one, you'll check the IO eey 50ms, it will loose some games only at very very fast time control