{"action":"created","issue":{"url":"https://api.github.com/repos/imor/uci/issues/24","repository_url":"https://api.github.com/repos/imor/uci","labels_url":"https://api.github.com/repos/imor/uci/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/imor/uci/issues/24/comments","events_url":"https://api.github.com/repos/imor/uci/issues/24/events","html_url":"https://github.com/imor/uci/issues/24","id":140028528,"number":24,"title":"Add depth and time bound (movetime) Go commands","user":{"login":"abhijeetnvaidya","id":5254684,"avatar_url":"https://avatars.githubusercontent.com/u/5254684?v=3","gravatar_id":"","url":"https://api.github.com/users/abhijeetnvaidya","html_url":"https://github.com/abhijeetnvaidya","followers_url":"https://api.github.com/users/abhijeetnvaidya/followers","following_url":"https://api.github.com/users/abhijeetnvaidya/following{/other_user}","gists_url":"https://api.github.com/users/abhijeetnvaidya/gists{/gist_id}","starred_url":"https://api.github.com/users/abhijeetnvaidya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhijeetnvaidya/subscriptions","organizations_url":"https://api.github.com/users/abhijeetnvaidya/orgs","repos_url":"https://api.github.com/users/abhijeetnvaidya/repos","events_url":"https://api.github.com/users/abhijeetnvaidya/events{/privacy}","received_events_url":"https://api.github.com/users/abhijeetnvaidya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-10T22:32:20Z","updated_at":"2016-03-11T04:44:21Z","closed_at":null,"body":"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.\r\nIn `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? \r\nIn 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.\r\n\r\n```javascript\r\n//---------------------------------------------------------------------\r\nEngine.prototype.depthLimitedGoCommand = function (infoHandler,\r\n                                                   depth) {\r\n    var self = this;\r\n    var deferred = Q.defer();\r\n\r\n    var engineStdoutListener = function (data) {\r\n        var lines = data.toString().split(endOfLineRegExp);\r\n        var last_multipv = \"\";\r\n        for (var i = 0; i < lines.length; i++) {\r\n            var stringifiedLine = S(lines[i]);\r\n            if (stringifiedLine.includes('multipv') && infoHandler) {\r\n                last_multipv = lines[i];\r\n                infoHandler(lines[i]);\r\n            } else if (stringifiedLine.startsWith('bestmove')) {\r\n                self.engineProcess.stdout.removeListener('data', engineStdoutListener);\r\n                var bestmove_components = stringifiedLine.split(\" \");\r\n                if (bestmove_components.length > 1) {\r\n                    //deferred.resolve(utilities.convertToMoveObject(bestmove_components[1]));\r\n                    deferred.resolve(last_multipv);\r\n                } else {\r\n                    throw new Error('Invalid format of bestmove. Expected \"bestmove <move>\". Returned \"' + lines[i] + '\"');\r\n                }\r\n            }\r\n        }\r\n    };\r\n\r\n    this.engineProcess.stdout.on('data', engineStdoutListener);\r\n    var commandString = 'go depth ' + depth;\r\n    this.engineProcess.stdin.write(commandString + endOfLine);\r\n    return deferred.promise;\r\n};\r\n\r\nEngine.prototype.timeBoundGoCommand = function (infoHandler,\r\n                                                t) {\r\n    var self = this;\r\n    var deferred = Q.defer();\r\n\r\n    var engineStdoutListener = function (data) {\r\n        var lines = data.toString().split(endOfLineRegExp);\r\n        var last_multipv = \"\";\r\n        for (var i = 0; i < lines.length; i++) {\r\n            var stringifiedLine = S(lines[i]);\r\n            if (stringifiedLine.includes('multipv') && infoHandler) {\r\n                last_multipv = lines[i];\r\n                infoHandler(lines[i]);\r\n            } else if (stringifiedLine.startsWith('bestmove')) {\r\n                self.engineProcess.stdout.removeListener('data', engineStdoutListener);\r\n                var bestmove_components = stringifiedLine.split(\" \");\r\n                if (bestmove_components.length > 1) {\r\n                    //deferred.resolve(utilities.convertToMoveObject(bestmove_components[1]));\r\n                    deferred.resolve(last_multipv);\r\n                } else {\r\n                    throw new Error('Invalid format of bestmove. Expected \"bestmove <move>\". Returned \"' + lines[i] + '\"');\r\n                }\r\n            }\r\n        }\r\n    };\r\n\r\n    this.engineProcess.stdout.on('data', engineStdoutListener);\r\n    var commandString = 'go movetime ' + t;\r\n    this.engineProcess.stdin.write(commandString + endOfLine);\r\n    return deferred.promise;\r\n};\r\n```"},"comment":{"url":"https://api.github.com/repos/imor/uci/issues/comments/195181258","html_url":"https://github.com/imor/uci/issues/24#issuecomment-195181258","issue_url":"https://api.github.com/repos/imor/uci/issues/24","id":195181258,"user":{"login":"imor","id":1666073,"avatar_url":"https://avatars.githubusercontent.com/u/1666073?v=3","gravatar_id":"","url":"https://api.github.com/users/imor","html_url":"https://github.com/imor","followers_url":"https://api.github.com/users/imor/followers","following_url":"https://api.github.com/users/imor/following{/other_user}","gists_url":"https://api.github.com/users/imor/gists{/gist_id}","starred_url":"https://api.github.com/users/imor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imor/subscriptions","organizations_url":"https://api.github.com/users/imor/orgs","repos_url":"https://api.github.com/users/imor/repos","events_url":"https://api.github.com/users/imor/events{/privacy}","received_events_url":"https://api.github.com/users/imor/received_events","type":"User","site_admin":false},"created_at":"2016-03-11T04:44:21Z","updated_at":"2016-03-11T04:44:21Z","body":"@abhijeetnvaidya Glad that you liked the library :+1:  . 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."}}