You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used this module recently and it worked very nicely (although understanding promises was a bit of a learning curve for me), so thanks for uploading this project.
In go infinite + stop approach, stockfish sometimes outputs a "bestmove" without "ponder" (especially for low time values with high multipv settings) as a result, the regular expression fails, why not change it to simple string split?
In my testing I found that go-infinite + stop approach is somewhat less stable than the go movetime one. The later lets engine overshoot few milliseconds to but gives correct output all the time.
//---------------------------------------------------------------------Engine.prototype.depthLimitedGoCommand=function(infoHandler,depth){varself=this;vardeferred=Q.defer();varengineStdoutListener=function(data){varlines=data.toString().split(endOfLineRegExp);varlast_multipv="";for(vari=0;i<lines.length;i++){varstringifiedLine=S(lines[i]);if(stringifiedLine.includes('multipv')&&infoHandler){last_multipv=lines[i];infoHandler(lines[i]);}elseif(stringifiedLine.startsWith('bestmove')){self.engineProcess.stdout.removeListener('data',engineStdoutListener);varbestmove_components=stringifiedLine.split(" ");if(bestmove_components.length>1){//deferred.resolve(utilities.convertToMoveObject(bestmove_components[1]));deferred.resolve(last_multipv);}else{thrownewError('Invalid format of bestmove. Expected "bestmove <move>". Returned "'+lines[i]+'"');}}}};this.engineProcess.stdout.on('data',engineStdoutListener);varcommandString='go depth '+depth;this.engineProcess.stdin.write(commandString+endOfLine);returndeferred.promise;};Engine.prototype.timeBoundGoCommand=function(infoHandler,t){varself=this;vardeferred=Q.defer();varengineStdoutListener=function(data){varlines=data.toString().split(endOfLineRegExp);varlast_multipv="";for(vari=0;i<lines.length;i++){varstringifiedLine=S(lines[i]);if(stringifiedLine.includes('multipv')&&infoHandler){last_multipv=lines[i];infoHandler(lines[i]);}elseif(stringifiedLine.startsWith('bestmove')){self.engineProcess.stdout.removeListener('data',engineStdoutListener);varbestmove_components=stringifiedLine.split(" ");if(bestmove_components.length>1){//deferred.resolve(utilities.convertToMoveObject(bestmove_components[1]));deferred.resolve(last_multipv);}else{thrownewError('Invalid format of bestmove. Expected "bestmove <move>". Returned "'+lines[i]+'"');}}}};this.engineProcess.stdout.on('data',engineStdoutListener);varcommandString='go movetime '+t;this.engineProcess.stdin.write(commandString+endOfLine);returndeferred.promise;};
The text was updated successfully, but these errors were encountered:
@abhijeetnvaidya Glad that you liked the library 👍 . I don't fully understand which part of the code fails (right now my guess is line 278). Can you please post your code and stockfish version with which you saw this behavior. This info will help me in fixing the bug. Also please post the full exception trace.
Glad that you liked the library 👍 . I don't fully understand which part of the code fails (right now my guess is line 278). Can you please post your code and stockfish version with which you saw this behavior. This info will help me in fixing the bug. Also please post the full exception trace.
make like this: ...).then(function () { console.log('New game started'); return engine.positionCommand('startpos', 'e2e4 e7e5'); }).then(function () { console.log('Starting position set'); console.log('Starting analysis'); return engine.goInfiniteCommand(function infoHandler(info) { console.log(info); }); }).delay(5000).then(function () {... with delay 5 sec
and append console.log like this in main.js: ...var engineStdoutListener = function (data) { console.log('engineStdoutListener',data.toString()); var lines = data.toString().split(endOfLineRegExp);...
im using engine: new Engine(__dirname+'/engines/stockfish_7_x64');
I used this module recently and it worked very nicely (although understanding promises was a bit of a learning curve for me), so thanks for uploading this project.
In
go infinite + stop
approach, stockfish sometimes outputs a "bestmove" without "ponder" (especially for low time values with high multipv settings) as a result, the regular expression fails, why not change it to simple string split?In my testing I found that
go-infinite + stop
approach is somewhat less stable than thego movetime
one. The later lets engine overshoot few milliseconds to but gives correct output all the time.The text was updated successfully, but these errors were encountered: