{"action":"created","comment":{"url":"https://api.github.com/repos/gcp/leela-zero/pulls/comments/157799776","pull_request_review_id":84501990,"id":157799776,"diff_hunk":"@@ -222,6 +222,36 @@ static void parse_commandline(int argc, char *argv[], bool & gtp_mode) {\n         }\n     }\n #endif\n+\n+    auto out = std::stringstream{};\n+    for (const auto& it : vm) {\n+        if (it.second.defaulted()) {\n+            continue;\n+        }\n+        auto &type = it.second.value().type();\n+\n+        out << \"--\" << it.first;\n+        if (type == typeid(uint64)) {\n+            out << \" \" << it.second.as<uint64>();\n+        } else if (type == typeid(std::string)) {\n+            // skip unary string options\n+            if (it.second.as<std::string>() != \"\") {\n+                // Sanitize user supplied strings\n+                out << \" \" << it.first;\n+            }\n+        } else if (type == typeid(int)) {\n+            out << \" \" << it.second.as<int>();\n+        } else if (type == typeid(float)) {\n+            out << \" \" << it.second.as<float>();\n+        } else {\n+            out << \" unknown option type\";\n+        }\n+        out << \" \";\n+    }","path":"src/Leela.cpp","position":29,"original_position":29,"commit_id":"8f923b931115d6fae462c27a1dd9cd2424890751","original_commit_id":"8f923b931115d6fae462c27a1dd9cd2424890751","user":{"login":"killerducky","id":64080,"avatar_url":"https://avatars3.githubusercontent.com/u/64080?v=4","gravatar_id":"","url":"https://api.github.com/users/killerducky","html_url":"https://github.com/killerducky","followers_url":"https://api.github.com/users/killerducky/followers","following_url":"https://api.github.com/users/killerducky/following{/other_user}","gists_url":"https://api.github.com/users/killerducky/gists{/gist_id}","starred_url":"https://api.github.com/users/killerducky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killerducky/subscriptions","organizations_url":"https://api.github.com/users/killerducky/orgs","repos_url":"https://api.github.com/users/killerducky/repos","events_url":"https://api.github.com/users/killerducky/events{/privacy}","received_events_url":"https://api.github.com/users/killerducky/received_events","type":"User","site_admin":false},"body":"It was easier this way to know which options take string arguments, so I can protect user information. If I parse argv/argc the code has to be updated when new string arguments are added. Also the parser takes care of all the weird cases like extra spaces etc that can happen, what if the weights filename has a space in it, or some weird characters. I don't want to rewrite a parser for those cases. \r\n\r\nThat said I can change it to parsing argv/argc if you want. Let me know.\r\n\r\n","created_at":"2017-12-19T16:12:41Z","updated_at":"2017-12-19T16:12:41Z","html_url":"https://github.com/gcp/leela-zero/pull/426#discussion_r157799776","pull_request_url":"https://api.github.com/repos/gcp/leela-zero/pulls/426","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/gcp/leela-zero/pulls/comments/157799776"},"html":{"href":"https://github.com/gcp/leela-zero/pull/426#discussion_r157799776"},"pull_request":{"href":"https://api.github.com/repos/gcp/leela-zero/pulls/426"}},"in_reply_to_id":157796402},"pull_request":{"url":"https://api.github.com/repos/gcp/leela-zero/pulls/426","id":159060277,"html_url":"https://github.com/gcp/leela-zero/pull/426","diff_url":"https://github.com/gcp/leela-zero/pull/426.diff","patch_url":"https://github.com/gcp/leela-zero/pull/426.patch","issue_url":"https://api.github.com/repos/gcp/leela-zero/issues/426","number":426,"state":"open","locked":false,"title":"Print cfg_options_str and TimeControl in comment of sgf files.","user":{"login":"killerducky","id":64080,"avatar_url":"https://avatars3.githubusercontent.com/u/64080?v=4","gravatar_id":"","url":"https://api.github.com/users/killerducky","html_url":"https://github.com/killerducky","followers_url":"https://api.github.com/users/killerducky/followers","following_url":"https://api.github.com/users/killerducky/following{/other_user}","gists_url":"https://api.github.com/users/killerducky/gists{/gist_id}","starred_url":"https://api.github.com/users/killerducky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killerducky/subscriptions","organizations_url":"https://api.github.com/users/killerducky/orgs","repos_url":"https://api.github.com/users/killerducky/repos","events_url":"https://api.github.com/users/killerducky/events{/privacy}","received_events_url":"https://api.github.com/users/killerducky/received_events","type":"User","site_admin":false},"body":"This will help users reproduce games. Also helps address #416 by making short games unique as long as they used different random seeds or other command line arguments.\r\n\r\nTime controls is a common source of confusion for users, and it's important to set correctly.\r\n\r\nExample sgf:\r\n```\r\n(;GM[1]FF[4]RU[Chinese]DT[2017-12-18]SZ[19]KM[7.5]PB[Leela Zero 0.9 /home/ao]PW[Human]RE[W+7.5]\r\nC[LeelaZ options: --noponder --playouts 1600 --weights weights --seed 15337825387906334875\r\nLeelaZ time control: 3600s absolute]\r\n\r\n;B[ap];W[pp])\r\n\r\n```\r\n\r\nNotice my user home directory is leaking in the PB field. I didn't change that code. The way autogtp works this won't happen because it uses the local directory. Also the printsgf GTP command is hard-coded to have the computer always white, human always black. Again it seems autogtp takes care of this part for us. These two things are only issues if someone is not using a GUI that writes SGFs and instead uses the GTP command. They can probably be cleaned up later.\r\n","created_at":"2017-12-19T01:44:40Z","updated_at":"2017-12-19T16:12:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb380dfa64eaaf1fb5d2c45854bd0327c2d62574","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/gcp/leela-zero/pulls/426/commits","review_comments_url":"https://api.github.com/repos/gcp/leela-zero/pulls/426/comments","review_comment_url":"https://api.github.com/repos/gcp/leela-zero/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gcp/leela-zero/issues/426/comments","statuses_url":"https://api.github.com/repos/gcp/leela-zero/statuses/8f923b931115d6fae462c27a1dd9cd2424890751","head":{"label":"killerducky:sgf_cmdline","ref":"sgf_cmdline","sha":"8f923b931115d6fae462c27a1dd9cd2424890751","user":{"login":"killerducky","id":64080,"avatar_url":"https://avatars3.githubusercontent.com/u/64080?v=4","gravatar_id":"","url":"https://api.github.com/users/killerducky","html_url":"https://github.com/killerducky","followers_url":"https://api.github.com/users/killerducky/followers","following_url":"https://api.github.com/users/killerducky/following{/other_user}","gists_url":"https://api.github.com/users/killerducky/gists{/gist_id}","starred_url":"https://api.github.com/users/killerducky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killerducky/subscriptions","organizations_url":"https://api.github.com/users/killerducky/orgs","repos_url":"https://api.github.com/users/killerducky/repos","events_url":"https://api.github.com/users/killerducky/events{/privacy}","received_events_url":"https://api.github.com/users/killerducky/received_events","type":"User","site_admin":false},"repo":{"id":108217476,"name":"leela-zero","full_name":"killerducky/leela-zero","owner":{"login":"killerducky","id":64080,"avatar_url":"https://avatars3.githubusercontent.com/u/64080?v=4","gravatar_id":"","url":"https://api.github.com/users/killerducky","html_url":"https://github.com/killerducky","followers_url":"https://api.github.com/users/killerducky/followers","following_url":"https://api.github.com/users/killerducky/following{/other_user}","gists_url":"https://api.github.com/users/killerducky/gists{/gist_id}","starred_url":"https://api.github.com/users/killerducky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killerducky/subscriptions","organizations_url":"https://api.github.com/users/killerducky/orgs","repos_url":"https://api.github.com/users/killerducky/repos","events_url":"https://api.github.com/users/killerducky/events{/privacy}","received_events_url":"https://api.github.com/users/killerducky/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/killerducky/leela-zero","description":"Go engine with no human-provided knowledge, modeled after the AlphaGo Zero paper.","fork":true,"url":"https://api.github.com/repos/killerducky/leela-zero","forks_url":"https://api.github.com/repos/killerducky/leela-zero/forks","keys_url":"https://api.github.com/repos/killerducky/leela-zero/keys{/key_id}","collaborators_url":"https://api.github.com/repos/killerducky/leela-zero/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/killerducky/leela-zero/teams","hooks_url":"https://api.github.com/repos/killerducky/leela-zero/hooks","issue_events_url":"https://api.github.com/repos/killerducky/leela-zero/issues/events{/number}","events_url":"https://api.github.com/repos/killerducky/leela-zero/events","assignees_url":"https://api.github.com/repos/killerducky/leela-zero/assignees{/user}","branches_url":"https://api.github.com/repos/killerducky/leela-zero/branches{/branch}","tags_url":"https://api.github.com/repos/killerducky/leela-zero/tags","blobs_url":"https://api.github.com/repos/killerducky/leela-zero/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/killerducky/leela-zero/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/killerducky/leela-zero/git/refs{/sha}","trees_url":"https://api.github.com/repos/killerducky/leela-zero/git/trees{/sha}","statuses_url":"https://api.github.com/repos/killerducky/leela-zero/statuses/{sha}","languages_url":"https://api.github.com/repos/killerducky/leela-zero/languages","stargazers_url":"https://api.github.com/repos/killerducky/leela-zero/stargazers","contributors_url":"https://api.github.com/repos/killerducky/leela-zero/contributors","subscribers_url":"https://api.github.com/repos/killerducky/leela-zero/subscribers","subscription_url":"https://api.github.com/repos/killerducky/leela-zero/subscription","commits_url":"https://api.github.com/repos/killerducky/leela-zero/commits{/sha}","git_commits_url":"https://api.github.com/repos/killerducky/leela-zero/git/commits{/sha}","comments_url":"https://api.github.com/repos/killerducky/leela-zero/comments{/number}","issue_comment_url":"https://api.github.com/repos/killerducky/leela-zero/issues/comments{/number}","contents_url":"https://api.github.com/repos/killerducky/leela-zero/contents/{+path}","compare_url":"https://api.github.com/repos/killerducky/leela-zero/compare/{base}...{head}","merges_url":"https://api.github.com/repos/killerducky/leela-zero/merges","archive_url":"https://api.github.com/repos/killerducky/leela-zero/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/killerducky/leela-zero/downloads","issues_url":"https://api.github.com/repos/killerducky/leela-zero/issues{/number}","pulls_url":"https://api.github.com/repos/killerducky/leela-zero/pulls{/number}","milestones_url":"https://api.github.com/repos/killerducky/leela-zero/milestones{/number}","notifications_url":"https://api.github.com/repos/killerducky/leela-zero/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/killerducky/leela-zero/labels{/name}","releases_url":"https://api.github.com/repos/killerducky/leela-zero/releases{/id}","deployments_url":"https://api.github.com/repos/killerducky/leela-zero/deployments","created_at":"2017-10-25T03:57:22Z","updated_at":"2017-12-17T19:48:41Z","pushed_at":"2017-12-19T01:57:19Z","git_url":"git://github.com/killerducky/leela-zero.git","ssh_url":"git@github.com:killerducky/leela-zero.git","clone_url":"https://github.com/killerducky/leela-zero.git","svn_url":"https://github.com/killerducky/leela-zero","homepage":null,"size":600,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gcp:next","ref":"next","sha":"235d5d67e13679c4ccb24607d3b244814fa51f28","user":{"login":"gcp","id":1104290,"avatar_url":"https://avatars2.githubusercontent.com/u/1104290?v=4","gravatar_id":"","url":"https://api.github.com/users/gcp","html_url":"https://github.com/gcp","followers_url":"https://api.github.com/users/gcp/followers","following_url":"https://api.github.com/users/gcp/following{/other_user}","gists_url":"https://api.github.com/users/gcp/gists{/gist_id}","starred_url":"https://api.github.com/users/gcp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcp/subscriptions","organizations_url":"https://api.github.com/users/gcp/orgs","repos_url":"https://api.github.com/users/gcp/repos","events_url":"https://api.github.com/users/gcp/events{/privacy}","received_events_url":"https://api.github.com/users/gcp/received_events","type":"User","site_admin":false},"repo":{"id":108166281,"name":"leela-zero","full_name":"gcp/leela-zero","owner":{"login":"gcp","id":1104290,"avatar_url":"https://avatars2.githubusercontent.com/u/1104290?v=4","gravatar_id":"","url":"https://api.github.com/users/gcp","html_url":"https://github.com/gcp","followers_url":"https://api.github.com/users/gcp/followers","following_url":"https://api.github.com/users/gcp/following{/other_user}","gists_url":"https://api.github.com/users/gcp/gists{/gist_id}","starred_url":"https://api.github.com/users/gcp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcp/subscriptions","organizations_url":"https://api.github.com/users/gcp/orgs","repos_url":"https://api.github.com/users/gcp/repos","events_url":"https://api.github.com/users/gcp/events{/privacy}","received_events_url":"https://api.github.com/users/gcp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gcp/leela-zero","description":"Go engine with no human-provided knowledge, modeled after the AlphaGo Zero paper.","fork":false,"url":"https://api.github.com/repos/gcp/leela-zero","forks_url":"https://api.github.com/repos/gcp/leela-zero/forks","keys_url":"https://api.github.com/repos/gcp/leela-zero/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gcp/leela-zero/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gcp/leela-zero/teams","hooks_url":"https://api.github.com/repos/gcp/leela-zero/hooks","issue_events_url":"https://api.github.com/repos/gcp/leela-zero/issues/events{/number}","events_url":"https://api.github.com/repos/gcp/leela-zero/events","assignees_url":"https://api.github.com/repos/gcp/leela-zero/assignees{/user}","branches_url":"https://api.github.com/repos/gcp/leela-zero/branches{/branch}","tags_url":"https://api.github.com/repos/gcp/leela-zero/tags","blobs_url":"https://api.github.com/repos/gcp/leela-zero/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gcp/leela-zero/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gcp/leela-zero/git/refs{/sha}","trees_url":"https://api.github.com/repos/gcp/leela-zero/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gcp/leela-zero/statuses/{sha}","languages_url":"https://api.github.com/repos/gcp/leela-zero/languages","stargazers_url":"https://api.github.com/repos/gcp/leela-zero/stargazers","contributors_url":"https://api.github.com/repos/gcp/leela-zero/contributors","subscribers_url":"https://api.github.com/repos/gcp/leela-zero/subscribers","subscription_url":"https://api.github.com/repos/gcp/leela-zero/subscription","commits_url":"https://api.github.com/repos/gcp/leela-zero/commits{/sha}","git_commits_url":"https://api.github.com/repos/gcp/leela-zero/git/commits{/sha}","comments_url":"https://api.github.com/repos/gcp/leela-zero/comments{/number}","issue_comment_url":"https://api.github.com/repos/gcp/leela-zero/issues/comments{/number}","contents_url":"https://api.github.com/repos/gcp/leela-zero/contents/{+path}","compare_url":"https://api.github.com/repos/gcp/leela-zero/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gcp/leela-zero/merges","archive_url":"https://api.github.com/repos/gcp/leela-zero/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gcp/leela-zero/downloads","issues_url":"https://api.github.com/repos/gcp/leela-zero/issues{/number}","pulls_url":"https://api.github.com/repos/gcp/leela-zero/pulls{/number}","milestones_url":"https://api.github.com/repos/gcp/leela-zero/milestones{/number}","notifications_url":"https://api.github.com/repos/gcp/leela-zero/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gcp/leela-zero/labels{/name}","releases_url":"https://api.github.com/repos/gcp/leela-zero/releases{/id}","deployments_url":"https://api.github.com/repos/gcp/leela-zero/deployments","created_at":"2017-10-24T18:19:43Z","updated_at":"2017-12-19T16:12:32Z","pushed_at":"2017-12-19T15:46:09Z","git_url":"git://github.com/gcp/leela-zero.git","ssh_url":"git@github.com:gcp/leela-zero.git","clone_url":"https://github.com/gcp/leela-zero.git","svn_url":"https://github.com/gcp/leela-zero","homepage":null,"size":572,"stargazers_count":1472,"watchers_count":1472,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":279,"mirror_url":null,"archived":false,"open_issues_count":119,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":279,"open_issues":119,"watchers":1472,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gcp/leela-zero/pulls/426"},"html":{"href":"https://github.com/gcp/leela-zero/pull/426"},"issue":{"href":"https://api.github.com/repos/gcp/leela-zero/issues/426"},"comments":{"href":"https://api.github.com/repos/gcp/leela-zero/issues/426/comments"},"review_comments":{"href":"https://api.github.com/repos/gcp/leela-zero/pulls/426/comments"},"review_comment":{"href":"https://api.github.com/repos/gcp/leela-zero/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gcp/leela-zero/pulls/426/commits"},"statuses":{"href":"https://api.github.com/repos/gcp/leela-zero/statuses/8f923b931115d6fae462c27a1dd9cd2424890751"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"killerducky"}}