{"action":"created","comment":{"url":"https://api.github.com/repos/mhauskn/rcssserver/pulls/comments/47426768","id":47426768,"diff_hunk":"@@ -3203,8 +3203,31 @@ HFORef::resetField()\n     boost::variate_generator<boost::mt19937&, boost::uniform_int<> >\n         gen(M_rng, boost::uniform_int<>());\n     std::random_shuffle( M_offsets.begin(), M_offsets.end(), gen);\n-    int offense_pos = 0;\n+    int offense_pos_on_ball = -1;\n+    int offense_count = 0;\n+    int hfo_offense_on_ball = ServerParam::instance().hfoOffenseOnBall();\n     const Stadium::PlayerCont::iterator end = M_stadium.players().end();\n+    if( hfo_offense_on_ball > 0 )\n+    {\n+        for ( Stadium::PlayerCont::iterator p = M_stadium.players().begin();\n+              p != end;\n+              ++p )\n+        {\n+    \t    if ( (*p)->isEnabled() && (*p)->side() == LEFT )\n+    \t    {\n+    \t\toffense_count++;\n+    \t    }\n+      \t}\n+      \tif ( ( hfo_offense_on_ball - offense_count ) > 0 )\n+      \t{\n+      \t    offense_pos_on_ball = (int)(drand(0,1,M_rng) * (offense_count));","path":"src/referee.cpp","position":22,"original_position":22,"commit_id":"107bef17fab45c1e062488ef3dd7c0cfd52841de","original_commit_id":"107bef17fab45c1e062488ef3dd7c0cfd52841de","user":{"login":"mhauskn","id":19769,"avatar_url":"https://avatars.githubusercontent.com/u/19769?v=3","gravatar_id":"","url":"https://api.github.com/users/mhauskn","html_url":"https://github.com/mhauskn","followers_url":"https://api.github.com/users/mhauskn/followers","following_url":"https://api.github.com/users/mhauskn/following{/other_user}","gists_url":"https://api.github.com/users/mhauskn/gists{/gist_id}","starred_url":"https://api.github.com/users/mhauskn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhauskn/subscriptions","organizations_url":"https://api.github.com/users/mhauskn/orgs","repos_url":"https://api.github.com/users/mhauskn/repos","events_url":"https://api.github.com/users/mhauskn/events{/privacy}","received_events_url":"https://api.github.com/users/mhauskn/received_events","type":"User","site_admin":false},"body":"I think it's more natural to use irand rather than drand here. Also no need to put offense_count in parens.","created_at":"2015-12-12T04:16:52Z","updated_at":"2015-12-12T04:16:52Z","html_url":"https://github.com/mhauskn/rcssserver/pull/3#discussion_r47426768","pull_request_url":"https://api.github.com/repos/mhauskn/rcssserver/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/mhauskn/rcssserver/pulls/comments/47426768"},"html":{"href":"https://github.com/mhauskn/rcssserver/pull/3#discussion_r47426768"},"pull_request":{"href":"https://api.github.com/repos/mhauskn/rcssserver/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/mhauskn/rcssserver/pulls/3","id":51629932,"html_url":"https://github.com/mhauskn/rcssserver/pull/3","diff_url":"https://github.com/mhauskn/rcssserver/pull/3.diff","patch_url":"https://github.com/mhauskn/rcssserver/pull/3.patch","issue_url":"https://api.github.com/repos/mhauskn/rcssserver/issues/3","number":3,"state":"open","locked":false,"title":"Added support for random offense player on ball.","user":{"login":"UNiQ10","id":6149374,"avatar_url":"https://avatars.githubusercontent.com/u/6149374?v=3","gravatar_id":"","url":"https://api.github.com/users/UNiQ10","html_url":"https://github.com/UNiQ10","followers_url":"https://api.github.com/users/UNiQ10/followers","following_url":"https://api.github.com/users/UNiQ10/following{/other_user}","gists_url":"https://api.github.com/users/UNiQ10/gists{/gist_id}","starred_url":"https://api.github.com/users/UNiQ10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UNiQ10/subscriptions","organizations_url":"https://api.github.com/users/UNiQ10/orgs","repos_url":"https://api.github.com/users/UNiQ10/repos","events_url":"https://api.github.com/users/UNiQ10/events{/privacy}","received_events_url":"https://api.github.com/users/UNiQ10/received_events","type":"User","site_admin":false},"body":"If the hfoOffenseOnBall parameter is greater than the number of offense players we pick a random offense player to be on ball.","created_at":"2015-11-24T08:34:26Z","updated_at":"2015-12-12T04:16:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0059fa7fb731b75ed48c679ea625f258601278e2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mhauskn/rcssserver/pulls/3/commits","review_comments_url":"https://api.github.com/repos/mhauskn/rcssserver/pulls/3/comments","review_comment_url":"https://api.github.com/repos/mhauskn/rcssserver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mhauskn/rcssserver/issues/3/comments","statuses_url":"https://api.github.com/repos/mhauskn/rcssserver/statuses/107bef17fab45c1e062488ef3dd7c0cfd52841de","head":{"label":"UNiQ10:patch-1","ref":"patch-1","sha":"107bef17fab45c1e062488ef3dd7c0cfd52841de","user":{"login":"UNiQ10","id":6149374,"avatar_url":"https://avatars.githubusercontent.com/u/6149374?v=3","gravatar_id":"","url":"https://api.github.com/users/UNiQ10","html_url":"https://github.com/UNiQ10","followers_url":"https://api.github.com/users/UNiQ10/followers","following_url":"https://api.github.com/users/UNiQ10/following{/other_user}","gists_url":"https://api.github.com/users/UNiQ10/gists{/gist_id}","starred_url":"https://api.github.com/users/UNiQ10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UNiQ10/subscriptions","organizations_url":"https://api.github.com/users/UNiQ10/orgs","repos_url":"https://api.github.com/users/UNiQ10/repos","events_url":"https://api.github.com/users/UNiQ10/events{/privacy}","received_events_url":"https://api.github.com/users/UNiQ10/received_events","type":"User","site_admin":false},"repo":{"id":46773967,"name":"rcssserver","full_name":"UNiQ10/rcssserver","owner":{"login":"UNiQ10","id":6149374,"avatar_url":"https://avatars.githubusercontent.com/u/6149374?v=3","gravatar_id":"","url":"https://api.github.com/users/UNiQ10","html_url":"https://github.com/UNiQ10","followers_url":"https://api.github.com/users/UNiQ10/followers","following_url":"https://api.github.com/users/UNiQ10/following{/other_user}","gists_url":"https://api.github.com/users/UNiQ10/gists{/gist_id}","starred_url":"https://api.github.com/users/UNiQ10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UNiQ10/subscriptions","organizations_url":"https://api.github.com/users/UNiQ10/orgs","repos_url":"https://api.github.com/users/UNiQ10/repos","events_url":"https://api.github.com/users/UNiQ10/events{/privacy}","received_events_url":"https://api.github.com/users/UNiQ10/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/UNiQ10/rcssserver","description":"RoboCup 2D Soccer Server","fork":true,"url":"https://api.github.com/repos/UNiQ10/rcssserver","forks_url":"https://api.github.com/repos/UNiQ10/rcssserver/forks","keys_url":"https://api.github.com/repos/UNiQ10/rcssserver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UNiQ10/rcssserver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UNiQ10/rcssserver/teams","hooks_url":"https://api.github.com/repos/UNiQ10/rcssserver/hooks","issue_events_url":"https://api.github.com/repos/UNiQ10/rcssserver/issues/events{/number}","events_url":"https://api.github.com/repos/UNiQ10/rcssserver/events","assignees_url":"https://api.github.com/repos/UNiQ10/rcssserver/assignees{/user}","branches_url":"https://api.github.com/repos/UNiQ10/rcssserver/branches{/branch}","tags_url":"https://api.github.com/repos/UNiQ10/rcssserver/tags","blobs_url":"https://api.github.com/repos/UNiQ10/rcssserver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UNiQ10/rcssserver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UNiQ10/rcssserver/git/refs{/sha}","trees_url":"https://api.github.com/repos/UNiQ10/rcssserver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UNiQ10/rcssserver/statuses/{sha}","languages_url":"https://api.github.com/repos/UNiQ10/rcssserver/languages","stargazers_url":"https://api.github.com/repos/UNiQ10/rcssserver/stargazers","contributors_url":"https://api.github.com/repos/UNiQ10/rcssserver/contributors","subscribers_url":"https://api.github.com/repos/UNiQ10/rcssserver/subscribers","subscription_url":"https://api.github.com/repos/UNiQ10/rcssserver/subscription","commits_url":"https://api.github.com/repos/UNiQ10/rcssserver/commits{/sha}","git_commits_url":"https://api.github.com/repos/UNiQ10/rcssserver/git/commits{/sha}","comments_url":"https://api.github.com/repos/UNiQ10/rcssserver/comments{/number}","issue_comment_url":"https://api.github.com/repos/UNiQ10/rcssserver/issues/comments{/number}","contents_url":"https://api.github.com/repos/UNiQ10/rcssserver/contents/{+path}","compare_url":"https://api.github.com/repos/UNiQ10/rcssserver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UNiQ10/rcssserver/merges","archive_url":"https://api.github.com/repos/UNiQ10/rcssserver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UNiQ10/rcssserver/downloads","issues_url":"https://api.github.com/repos/UNiQ10/rcssserver/issues{/number}","pulls_url":"https://api.github.com/repos/UNiQ10/rcssserver/pulls{/number}","milestones_url":"https://api.github.com/repos/UNiQ10/rcssserver/milestones{/number}","notifications_url":"https://api.github.com/repos/UNiQ10/rcssserver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UNiQ10/rcssserver/labels{/name}","releases_url":"https://api.github.com/repos/UNiQ10/rcssserver/releases{/id}","created_at":"2015-11-24T07:16:31Z","updated_at":"2015-11-24T07:16:32Z","pushed_at":"2015-11-24T08:06:10Z","git_url":"git://github.com/UNiQ10/rcssserver.git","ssh_url":"git@github.com:UNiQ10/rcssserver.git","clone_url":"https://github.com/UNiQ10/rcssserver.git","svn_url":"https://github.com/UNiQ10/rcssserver","homepage":null,"size":925,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mhauskn:master","ref":"master","sha":"dae5327d638d367f0f0f4acc166890a7cf39acb6","user":{"login":"mhauskn","id":19769,"avatar_url":"https://avatars.githubusercontent.com/u/19769?v=3","gravatar_id":"","url":"https://api.github.com/users/mhauskn","html_url":"https://github.com/mhauskn","followers_url":"https://api.github.com/users/mhauskn/followers","following_url":"https://api.github.com/users/mhauskn/following{/other_user}","gists_url":"https://api.github.com/users/mhauskn/gists{/gist_id}","starred_url":"https://api.github.com/users/mhauskn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhauskn/subscriptions","organizations_url":"https://api.github.com/users/mhauskn/orgs","repos_url":"https://api.github.com/users/mhauskn/repos","events_url":"https://api.github.com/users/mhauskn/events{/privacy}","received_events_url":"https://api.github.com/users/mhauskn/received_events","type":"User","site_admin":false},"repo":{"id":42683229,"name":"rcssserver","full_name":"mhauskn/rcssserver","owner":{"login":"mhauskn","id":19769,"avatar_url":"https://avatars.githubusercontent.com/u/19769?v=3","gravatar_id":"","url":"https://api.github.com/users/mhauskn","html_url":"https://github.com/mhauskn","followers_url":"https://api.github.com/users/mhauskn/followers","following_url":"https://api.github.com/users/mhauskn/following{/other_user}","gists_url":"https://api.github.com/users/mhauskn/gists{/gist_id}","starred_url":"https://api.github.com/users/mhauskn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhauskn/subscriptions","organizations_url":"https://api.github.com/users/mhauskn/orgs","repos_url":"https://api.github.com/users/mhauskn/repos","events_url":"https://api.github.com/users/mhauskn/events{/privacy}","received_events_url":"https://api.github.com/users/mhauskn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mhauskn/rcssserver","description":"RoboCup 2D Soccer Server","fork":false,"url":"https://api.github.com/repos/mhauskn/rcssserver","forks_url":"https://api.github.com/repos/mhauskn/rcssserver/forks","keys_url":"https://api.github.com/repos/mhauskn/rcssserver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mhauskn/rcssserver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mhauskn/rcssserver/teams","hooks_url":"https://api.github.com/repos/mhauskn/rcssserver/hooks","issue_events_url":"https://api.github.com/repos/mhauskn/rcssserver/issues/events{/number}","events_url":"https://api.github.com/repos/mhauskn/rcssserver/events","assignees_url":"https://api.github.com/repos/mhauskn/rcssserver/assignees{/user}","branches_url":"https://api.github.com/repos/mhauskn/rcssserver/branches{/branch}","tags_url":"https://api.github.com/repos/mhauskn/rcssserver/tags","blobs_url":"https://api.github.com/repos/mhauskn/rcssserver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mhauskn/rcssserver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mhauskn/rcssserver/git/refs{/sha}","trees_url":"https://api.github.com/repos/mhauskn/rcssserver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mhauskn/rcssserver/statuses/{sha}","languages_url":"https://api.github.com/repos/mhauskn/rcssserver/languages","stargazers_url":"https://api.github.com/repos/mhauskn/rcssserver/stargazers","contributors_url":"https://api.github.com/repos/mhauskn/rcssserver/contributors","subscribers_url":"https://api.github.com/repos/mhauskn/rcssserver/subscribers","subscription_url":"https://api.github.com/repos/mhauskn/rcssserver/subscription","commits_url":"https://api.github.com/repos/mhauskn/rcssserver/commits{/sha}","git_commits_url":"https://api.github.com/repos/mhauskn/rcssserver/git/commits{/sha}","comments_url":"https://api.github.com/repos/mhauskn/rcssserver/comments{/number}","issue_comment_url":"https://api.github.com/repos/mhauskn/rcssserver/issues/comments{/number}","contents_url":"https://api.github.com/repos/mhauskn/rcssserver/contents/{+path}","compare_url":"https://api.github.com/repos/mhauskn/rcssserver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mhauskn/rcssserver/merges","archive_url":"https://api.github.com/repos/mhauskn/rcssserver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mhauskn/rcssserver/downloads","issues_url":"https://api.github.com/repos/mhauskn/rcssserver/issues{/number}","pulls_url":"https://api.github.com/repos/mhauskn/rcssserver/pulls{/number}","milestones_url":"https://api.github.com/repos/mhauskn/rcssserver/milestones{/number}","notifications_url":"https://api.github.com/repos/mhauskn/rcssserver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mhauskn/rcssserver/labels{/name}","releases_url":"https://api.github.com/repos/mhauskn/rcssserver/releases{/id}","created_at":"2015-09-17T21:34:52Z","updated_at":"2015-09-17T21:36:34Z","pushed_at":"2015-11-24T08:34:26Z","git_url":"git://github.com/mhauskn/rcssserver.git","ssh_url":"git@github.com:mhauskn/rcssserver.git","clone_url":"https://github.com/mhauskn/rcssserver.git","svn_url":"https://github.com/mhauskn/rcssserver","homepage":null,"size":1084,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mhauskn/rcssserver/pulls/3"},"html":{"href":"https://github.com/mhauskn/rcssserver/pull/3"},"issue":{"href":"https://api.github.com/repos/mhauskn/rcssserver/issues/3"},"comments":{"href":"https://api.github.com/repos/mhauskn/rcssserver/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/mhauskn/rcssserver/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/mhauskn/rcssserver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mhauskn/rcssserver/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/mhauskn/rcssserver/statuses/107bef17fab45c1e062488ef3dd7c0cfd52841de"}}}}