Closed maksimKorzh closed 3 years ago
Just installed newest nodejs - now it works like a charm!
re: my question - I found this function in your code:
function CheckUp() { var currentTime = Date.now() - startTime; if (currDepth >= 2 && currentTime >= minSearchTime) { if (!ScoreDrop || currentTime >= maxSearchTime) { timeStop = 1; } } }
It's almost the same as in VICE but actually doesn't allow to return best move instantly - I tried it via GUI - yes, not working - it will calculate until the time is up, then sets timeStop to 1 and then returns best move. Exactly the same way it works in my engine.
So didn't you find a way to stop search and return best move "on demand"?
Hi Tamas
Sorry for trying to reach you in a such a weird way, maybe I should ping you on talkchess. I'm the author of BBC engine and we had a chat on talkchess a couple of times.
Well, first of all I didn't manage to run tomitankChess on linux, here's the error raised by nodejs:
TypeError: Cannot read property 'split' of null at onMessage (/home/maksim/Downloads/tomitankChess-master/tomitankChess.js:3629:35) at ReadStream.<anonymous> (/home/maksim/Downloads/tomitankChess-master/tomitankChess.js:3589:4) at emitNone (events.js:106:13) at ReadStream.emit (events.js:208:7) at emitReadable_ (_stream_readable.js:513:10) at emitReadable (_stream_readable.js:507:7) at ReadStream.Readable.read (_stream_readable.js:384:7) at ReadStream.Socket.read (net.js:375:43) at nReadingNextTick (_stream_readable.js:797:8) at _combinedTickCallback (internal/process/next_tick.js:135:11)
Probably it's because I have nodejs version 8, I believe it should work with latest version, but it's not the point. I'm now porting one of my engines to javascript and want it to be running in both browser and UCI mode just like tomitank does. I've managed to implement both modes (UCI at the proof of concept state for now but works), BUT I have a horrible issue that I have no idea how to solve:
I don't know how to read keyboard buffer during communicate() that runs every 2047 nodes in negamax search in a fassion like VICE does. I was studying tomitank's code and noticed that some parts seem to be inspired by VICE, well at very least they tell me that you're familiar with that code, so my next question follows...
... So here's how read from key board buffer looks like in VICE:
int search(alpha, beta, depth) { if ((nodes & 2047 ) == 0) checkUp(); if (!depth) return quiescence(); ... }
and then checkUp sets info.stopped = 1 to indicate that time is up and then it reads keyboard buffer: ` int input_waiting() {
ifndef WIN32
} ` Above code seems to be OS dependent and I don't know how to reproduce it in nodejs. I tried setting console mode to raw and read keypresses - it works in a global listener but never within search. I also tried to read stdin directly but some weird errors occurred.
I want simply to be able to return best move from current iteration of iterative deepening, but have no idea how technically that can be done. Interacting via messages between parent and child process allows only to kill child process but I didn't manage to return best move before that for SIGINT handler works only if running process directly and not via child process.
Finally questions: