{"action":"created","issue":{"url":"https://api.github.com/repos/zd3nik/SenjoUCIAdapter/issues/1","labels_url":"https://api.github.com/repos/zd3nik/SenjoUCIAdapter/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/zd3nik/SenjoUCIAdapter/issues/1/comments","events_url":"https://api.github.com/repos/zd3nik/SenjoUCIAdapter/issues/1/events","html_url":"https://github.com/zd3nik/SenjoUCIAdapter/issues/1","id":60485188,"number":1,"title":"movetime not working","user":{"login":"jimbo321","id":11406466,"avatar_url":"https://avatars.githubusercontent.com/u/11406466?v=3","gravatar_id":"","url":"https://api.github.com/users/jimbo321","html_url":"https://github.com/jimbo321","followers_url":"https://api.github.com/users/jimbo321/followers","following_url":"https://api.github.com/users/jimbo321/following{/other_user}","gists_url":"https://api.github.com/users/jimbo321/gists{/gist_id}","starred_url":"https://api.github.com/users/jimbo321/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimbo321/subscriptions","organizations_url":"https://api.github.com/users/jimbo321/orgs","repos_url":"https://api.github.com/users/jimbo321/repos","events_url":"https://api.github.com/users/jimbo321/events{/privacy}","received_events_url":"https://api.github.com/users/jimbo321/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-10T11:26:11Z","updated_at":"2015-03-10T12:04:42Z","closed_at":null,"body":"Hi great project. Noticed movetime not working when I compiled clubfoot. Quick dirty fix below >\r\n\r\n-----------------------------------------------------------------------------------------\r\n\r\nstd::string ChessEngine::Go(const int depth,\r\n                            const int movestogo,\r\n                            const uint64_t movetime,\r\n                            const uint64_t wtime, const uint64_t winc,\r\n                            const uint64_t btime, const uint64_t binc,\r\n                            std::string* ponder)\r\n{\r\n\r\n uint64_t endTime          = 0;\r\n uint64_t timePerMove   = 0;\r\n uint64_t timeRemaining = 0;\r\n\r\n  _stop &= ~StopReason::Timeout;\r\n  _searching = true;\r\n  _startTime = Now();\r\n\r\n  // set _stopTime to something smarter in MyGo() if you wish\r\n  \r\n    if (movetime) {\r\n\r\n    timePerMove = ( movetime/1000 );\r\n    endTime = (_startTime + timePerMove);\r\n    _stopTime = endTime;\r\n     \r\n    }else{\r\n    timeRemaining = (WhiteToMove() ? wtime : btime);\r\n    }\r\n--------------------------------------------------------------------\r\n\r\nCheers Jim Ablett.\r\n"},"comment":{"url":"https://api.github.com/repos/zd3nik/SenjoUCIAdapter/issues/comments/78040726","html_url":"https://github.com/zd3nik/SenjoUCIAdapter/issues/1#issuecomment-78040726","issue_url":"https://api.github.com/repos/zd3nik/SenjoUCIAdapter/issues/1","id":78040726,"user":{"login":"jimbo321","id":11406466,"avatar_url":"https://avatars.githubusercontent.com/u/11406466?v=3","gravatar_id":"","url":"https://api.github.com/users/jimbo321","html_url":"https://github.com/jimbo321","followers_url":"https://api.github.com/users/jimbo321/followers","following_url":"https://api.github.com/users/jimbo321/following{/other_user}","gists_url":"https://api.github.com/users/jimbo321/gists{/gist_id}","starred_url":"https://api.github.com/users/jimbo321/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimbo321/subscriptions","organizations_url":"https://api.github.com/users/jimbo321/orgs","repos_url":"https://api.github.com/users/jimbo321/repos","events_url":"https://api.github.com/users/jimbo321/events{/privacy}","received_events_url":"https://api.github.com/users/jimbo321/received_events","type":"User","site_admin":false},"created_at":"2015-03-10T12:04:42Z","updated_at":"2015-03-10T12:04:42Z","body":"Sorry that breaks tournament time. This works better >\r\n\r\n---------------------------------------------------------------------\r\n\r\n // set _stopTime to something smarter in MyGo() if you wish\r\n  _stopTime = (movetime ? (_startTime + movetime) : 0);\r\n  const uint64_t timeRemaining = (WhiteToMove() ? wtime : btime);\r\n  \r\nuint64_t endTime = 0;\r\n\r\n   if (movetime) {\r\n      endTime = (_startTime + movetime/1000);\r\n\r\n}else\r\n\r\n     if (timeRemaining) {\r\n    const int moves = (movestogo ? movestogo : MovesToGo());\r\n    const uint64_t timePerMove = (timeRemaining / moves);\r\n    endTime = (_startTime + timePerMove);\r\n    \r\n  }\r\n  \r\n    if (!_stopTime || (endTime < _stopTime)) {\r\n      _stopTime = endTime;\r\n    }\r\n  \r\n\r\n  if (UseTimer() && !timerThread.Active()) {\r\n    if (!timerThread.Start(Timer, this)) {\r\n      Output() << \"Failed to start timer thread!\";\r\n    }\r\n  }\r\n\r\n--------------------------------------------------------"}}