{"action":"created","comment":{"url":"https://api.github.com/repos/polytopal/worlds-war/pulls/comments/63924522","id":63924522,"diff_hunk":"@@ -0,0 +1,103 @@\n+package fr.utbm.info.vi51.worldswar.agent.behaviour.operational;\n+\n+import static fr.utbm.info.vi51.worldswar.perception.PerceptionGrid.MY_POSITION;\n+\n+import java.awt.Point;\n+import java.util.ArrayList;\n+import java.util.HashMap;\n+import java.util.Random;\n+\n+import fr.utbm.info.vi51.worldswar.environment.PheromoneType;\n+import fr.utbm.info.vi51.worldswar.environment.influence.DoNothingInfluence;\n+import fr.utbm.info.vi51.worldswar.environment.influence.DropFoodInfluence;\n+import fr.utbm.info.vi51.worldswar.environment.influence.Influence;\n+import fr.utbm.info.vi51.worldswar.environment.influence.MoveInfluence;\n+import fr.utbm.info.vi51.worldswar.environment.influence.PheromoneAndMoveInfluence;\n+import fr.utbm.info.vi51.worldswar.environment.influence.PickFoodInfluence;\n+import fr.utbm.info.vi51.worldswar.perception.AntPerception;\n+import fr.utbm.info.vi51.worldswar.utils.Direction;\n+\n+public class AntOperationalBehaviour {\n+\n+\tprivate static final float MAX_PHEROMONE = 10;\n+\tprivate static final float PHEROMONE_DECAY = 0.05f;\n+\n+\tprivate static final int MAX_PHEROMONE_DISTANCE = (int) (MAX_PHEROMONE / PHEROMONE_DECAY);\n+\n+\t/**\n+\t * Move in a direction to the target\n+\t * \n+\t * @param perception\n+\t * @param memory\n+\t * @param target\n+\t * @return\n+\t */\n+\tpublic Influence moveToTarget(AntPerception perception, HashMap<String, Object> memory, Point target) {\n+\t\tArrayList<Direction> viableDirections = new ArrayList<>(2);\n+\t\tif (target.x < 0) {\n+\t\t\tviableDirections.add(Direction.WEST);\n+\t\t} else if (target.x > 0) {\n+\t\t\tviableDirections.add(Direction.EAST);\n+\t\t}\n+\t\tif (target.y < 0) {\n+\t\t\tviableDirections.add(Direction.NORTH);\n+\t\t} else if (target.y > 0) {\n+\t\t\tviableDirections.add(Direction.SOUTH);\n+\t\t}","path":"src/main/sarl/fr/utbm/info/vi51/worldswar/agent/behaviour/operational/AntOperationalBehaviour.java","position":46,"original_position":46,"commit_id":"57e95edd532c38f2e3b8417c2458a11ce3bbbd3d","original_commit_id":"57e95edd532c38f2e3b8417c2458a11ce3bbbd3d","user":{"login":"leo-roggy","id":9866378,"avatar_url":"https://avatars.githubusercontent.com/u/9866378?v=3","gravatar_id":"","url":"https://api.github.com/users/leo-roggy","html_url":"https://github.com/leo-roggy","followers_url":"https://api.github.com/users/leo-roggy/followers","following_url":"https://api.github.com/users/leo-roggy/following{/other_user}","gists_url":"https://api.github.com/users/leo-roggy/gists{/gist_id}","starred_url":"https://api.github.com/users/leo-roggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leo-roggy/subscriptions","organizations_url":"https://api.github.com/users/leo-roggy/orgs","repos_url":"https://api.github.com/users/leo-roggy/repos","events_url":"https://api.github.com/users/leo-roggy/events{/privacy}","received_events_url":"https://api.github.com/users/leo-roggy/received_events","type":"User","site_admin":false},"body":"Autoriser les mouvement en diagonale, ça évitera en partie le creep block","created_at":"2016-05-19T17:53:02Z","updated_at":"2016-05-19T17:53:02Z","html_url":"https://github.com/polytopal/worlds-war/pull/58#discussion_r63924522","pull_request_url":"https://api.github.com/repos/polytopal/worlds-war/pulls/58","_links":{"self":{"href":"https://api.github.com/repos/polytopal/worlds-war/pulls/comments/63924522"},"html":{"href":"https://github.com/polytopal/worlds-war/pull/58#discussion_r63924522"},"pull_request":{"href":"https://api.github.com/repos/polytopal/worlds-war/pulls/58"}}},"pull_request":{"url":"https://api.github.com/repos/polytopal/worlds-war/pulls/58","id":70652797,"html_url":"https://github.com/polytopal/worlds-war/pull/58","diff_url":"https://github.com/polytopal/worlds-war/pull/58.diff","patch_url":"https://github.com/polytopal/worlds-war/pull/58.patch","issue_url":"https://api.github.com/repos/polytopal/worlds-war/issues/58","number":58,"state":"open","locked":false,"title":"Gatherer ai","user":{"login":"polytopal","id":9880409,"avatar_url":"https://avatars.githubusercontent.com/u/9880409?v=3","gravatar_id":"","url":"https://api.github.com/users/polytopal","html_url":"https://github.com/polytopal","followers_url":"https://api.github.com/users/polytopal/followers","following_url":"https://api.github.com/users/polytopal/following{/other_user}","gists_url":"https://api.github.com/users/polytopal/gists{/gist_id}","starred_url":"https://api.github.com/users/polytopal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polytopal/subscriptions","organizations_url":"https://api.github.com/users/polytopal/orgs","repos_url":"https://api.github.com/users/polytopal/repos","events_url":"https://api.github.com/users/polytopal/events{/privacy}","received_events_url":"https://api.github.com/users/polytopal/received_events","type":"User","site_admin":false},"body":"WIP, y'a beaucoup de commentaires à rajouter","created_at":"2016-05-19T08:18:13Z","updated_at":"2016-05-19T17:53:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"325de63edd5b48f20f20d19509397eb5344d83b4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/polytopal/worlds-war/pulls/58/commits","review_comments_url":"https://api.github.com/repos/polytopal/worlds-war/pulls/58/comments","review_comment_url":"https://api.github.com/repos/polytopal/worlds-war/pulls/comments{/number}","comments_url":"https://api.github.com/repos/polytopal/worlds-war/issues/58/comments","statuses_url":"https://api.github.com/repos/polytopal/worlds-war/statuses/57e95edd532c38f2e3b8417c2458a11ce3bbbd3d","head":{"label":"polytopal:gatherer-ai","ref":"gatherer-ai","sha":"57e95edd532c38f2e3b8417c2458a11ce3bbbd3d","user":{"login":"polytopal","id":9880409,"avatar_url":"https://avatars.githubusercontent.com/u/9880409?v=3","gravatar_id":"","url":"https://api.github.com/users/polytopal","html_url":"https://github.com/polytopal","followers_url":"https://api.github.com/users/polytopal/followers","following_url":"https://api.github.com/users/polytopal/following{/other_user}","gists_url":"https://api.github.com/users/polytopal/gists{/gist_id}","starred_url":"https://api.github.com/users/polytopal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polytopal/subscriptions","organizations_url":"https://api.github.com/users/polytopal/orgs","repos_url":"https://api.github.com/users/polytopal/repos","events_url":"https://api.github.com/users/polytopal/events{/privacy}","received_events_url":"https://api.github.com/users/polytopal/received_events","type":"User","site_admin":false},"repo":{"id":54734507,"name":"worlds-war","full_name":"polytopal/worlds-war","owner":{"login":"polytopal","id":9880409,"avatar_url":"https://avatars.githubusercontent.com/u/9880409?v=3","gravatar_id":"","url":"https://api.github.com/users/polytopal","html_url":"https://github.com/polytopal","followers_url":"https://api.github.com/users/polytopal/followers","following_url":"https://api.github.com/users/polytopal/following{/other_user}","gists_url":"https://api.github.com/users/polytopal/gists{/gist_id}","starred_url":"https://api.github.com/users/polytopal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polytopal/subscriptions","organizations_url":"https://api.github.com/users/polytopal/orgs","repos_url":"https://api.github.com/users/polytopal/repos","events_url":"https://api.github.com/users/polytopal/events{/privacy}","received_events_url":"https://api.github.com/users/polytopal/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/polytopal/worlds-war","description":"","fork":false,"url":"https://api.github.com/repos/polytopal/worlds-war","forks_url":"https://api.github.com/repos/polytopal/worlds-war/forks","keys_url":"https://api.github.com/repos/polytopal/worlds-war/keys{/key_id}","collaborators_url":"https://api.github.com/repos/polytopal/worlds-war/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/polytopal/worlds-war/teams","hooks_url":"https://api.github.com/repos/polytopal/worlds-war/hooks","issue_events_url":"https://api.github.com/repos/polytopal/worlds-war/issues/events{/number}","events_url":"https://api.github.com/repos/polytopal/worlds-war/events","assignees_url":"https://api.github.com/repos/polytopal/worlds-war/assignees{/user}","branches_url":"https://api.github.com/repos/polytopal/worlds-war/branches{/branch}","tags_url":"https://api.github.com/repos/polytopal/worlds-war/tags","blobs_url":"https://api.github.com/repos/polytopal/worlds-war/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/polytopal/worlds-war/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/polytopal/worlds-war/git/refs{/sha}","trees_url":"https://api.github.com/repos/polytopal/worlds-war/git/trees{/sha}","statuses_url":"https://api.github.com/repos/polytopal/worlds-war/statuses/{sha}","languages_url":"https://api.github.com/repos/polytopal/worlds-war/languages","stargazers_url":"https://api.github.com/repos/polytopal/worlds-war/stargazers","contributors_url":"https://api.github.com/repos/polytopal/worlds-war/contributors","subscribers_url":"https://api.github.com/repos/polytopal/worlds-war/subscribers","subscription_url":"https://api.github.com/repos/polytopal/worlds-war/subscription","commits_url":"https://api.github.com/repos/polytopal/worlds-war/commits{/sha}","git_commits_url":"https://api.github.com/repos/polytopal/worlds-war/git/commits{/sha}","comments_url":"https://api.github.com/repos/polytopal/worlds-war/comments{/number}","issue_comment_url":"https://api.github.com/repos/polytopal/worlds-war/issues/comments{/number}","contents_url":"https://api.github.com/repos/polytopal/worlds-war/contents/{+path}","compare_url":"https://api.github.com/repos/polytopal/worlds-war/compare/{base}...{head}","merges_url":"https://api.github.com/repos/polytopal/worlds-war/merges","archive_url":"https://api.github.com/repos/polytopal/worlds-war/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/polytopal/worlds-war/downloads","issues_url":"https://api.github.com/repos/polytopal/worlds-war/issues{/number}","pulls_url":"https://api.github.com/repos/polytopal/worlds-war/pulls{/number}","milestones_url":"https://api.github.com/repos/polytopal/worlds-war/milestones{/number}","notifications_url":"https://api.github.com/repos/polytopal/worlds-war/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/polytopal/worlds-war/labels{/name}","releases_url":"https://api.github.com/repos/polytopal/worlds-war/releases{/id}","deployments_url":"https://api.github.com/repos/polytopal/worlds-war/deployments","created_at":"2016-03-25T17:18:06Z","updated_at":"2016-04-15T16:40:58Z","pushed_at":"2016-05-19T08:36:28Z","git_url":"git://github.com/polytopal/worlds-war.git","ssh_url":"git@github.com:polytopal/worlds-war.git","clone_url":"https://github.com/polytopal/worlds-war.git","svn_url":"https://github.com/polytopal/worlds-war","homepage":null,"size":459,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":0,"default_branch":"master"}},"base":{"label":"polytopal:master","ref":"master","sha":"e429057a11d719a01724212eaca25474b76a093b","user":{"login":"polytopal","id":9880409,"avatar_url":"https://avatars.githubusercontent.com/u/9880409?v=3","gravatar_id":"","url":"https://api.github.com/users/polytopal","html_url":"https://github.com/polytopal","followers_url":"https://api.github.com/users/polytopal/followers","following_url":"https://api.github.com/users/polytopal/following{/other_user}","gists_url":"https://api.github.com/users/polytopal/gists{/gist_id}","starred_url":"https://api.github.com/users/polytopal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polytopal/subscriptions","organizations_url":"https://api.github.com/users/polytopal/orgs","repos_url":"https://api.github.com/users/polytopal/repos","events_url":"https://api.github.com/users/polytopal/events{/privacy}","received_events_url":"https://api.github.com/users/polytopal/received_events","type":"User","site_admin":false},"repo":{"id":54734507,"name":"worlds-war","full_name":"polytopal/worlds-war","owner":{"login":"polytopal","id":9880409,"avatar_url":"https://avatars.githubusercontent.com/u/9880409?v=3","gravatar_id":"","url":"https://api.github.com/users/polytopal","html_url":"https://github.com/polytopal","followers_url":"https://api.github.com/users/polytopal/followers","following_url":"https://api.github.com/users/polytopal/following{/other_user}","gists_url":"https://api.github.com/users/polytopal/gists{/gist_id}","starred_url":"https://api.github.com/users/polytopal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polytopal/subscriptions","organizations_url":"https://api.github.com/users/polytopal/orgs","repos_url":"https://api.github.com/users/polytopal/repos","events_url":"https://api.github.com/users/polytopal/events{/privacy}","received_events_url":"https://api.github.com/users/polytopal/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/polytopal/worlds-war","description":"","fork":false,"url":"https://api.github.com/repos/polytopal/worlds-war","forks_url":"https://api.github.com/repos/polytopal/worlds-war/forks","keys_url":"https://api.github.com/repos/polytopal/worlds-war/keys{/key_id}","collaborators_url":"https://api.github.com/repos/polytopal/worlds-war/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/polytopal/worlds-war/teams","hooks_url":"https://api.github.com/repos/polytopal/worlds-war/hooks","issue_events_url":"https://api.github.com/repos/polytopal/worlds-war/issues/events{/number}","events_url":"https://api.github.com/repos/polytopal/worlds-war/events","assignees_url":"https://api.github.com/repos/polytopal/worlds-war/assignees{/user}","branches_url":"https://api.github.com/repos/polytopal/worlds-war/branches{/branch}","tags_url":"https://api.github.com/repos/polytopal/worlds-war/tags","blobs_url":"https://api.github.com/repos/polytopal/worlds-war/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/polytopal/worlds-war/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/polytopal/worlds-war/git/refs{/sha}","trees_url":"https://api.github.com/repos/polytopal/worlds-war/git/trees{/sha}","statuses_url":"https://api.github.com/repos/polytopal/worlds-war/statuses/{sha}","languages_url":"https://api.github.com/repos/polytopal/worlds-war/languages","stargazers_url":"https://api.github.com/repos/polytopal/worlds-war/stargazers","contributors_url":"https://api.github.com/repos/polytopal/worlds-war/contributors","subscribers_url":"https://api.github.com/repos/polytopal/worlds-war/subscribers","subscription_url":"https://api.github.com/repos/polytopal/worlds-war/subscription","commits_url":"https://api.github.com/repos/polytopal/worlds-war/commits{/sha}","git_commits_url":"https://api.github.com/repos/polytopal/worlds-war/git/commits{/sha}","comments_url":"https://api.github.com/repos/polytopal/worlds-war/comments{/number}","issue_comment_url":"https://api.github.com/repos/polytopal/worlds-war/issues/comments{/number}","contents_url":"https://api.github.com/repos/polytopal/worlds-war/contents/{+path}","compare_url":"https://api.github.com/repos/polytopal/worlds-war/compare/{base}...{head}","merges_url":"https://api.github.com/repos/polytopal/worlds-war/merges","archive_url":"https://api.github.com/repos/polytopal/worlds-war/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/polytopal/worlds-war/downloads","issues_url":"https://api.github.com/repos/polytopal/worlds-war/issues{/number}","pulls_url":"https://api.github.com/repos/polytopal/worlds-war/pulls{/number}","milestones_url":"https://api.github.com/repos/polytopal/worlds-war/milestones{/number}","notifications_url":"https://api.github.com/repos/polytopal/worlds-war/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/polytopal/worlds-war/labels{/name}","releases_url":"https://api.github.com/repos/polytopal/worlds-war/releases{/id}","deployments_url":"https://api.github.com/repos/polytopal/worlds-war/deployments","created_at":"2016-03-25T17:18:06Z","updated_at":"2016-04-15T16:40:58Z","pushed_at":"2016-05-19T08:36:28Z","git_url":"git://github.com/polytopal/worlds-war.git","ssh_url":"git@github.com:polytopal/worlds-war.git","clone_url":"https://github.com/polytopal/worlds-war.git","svn_url":"https://github.com/polytopal/worlds-war","homepage":null,"size":459,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/polytopal/worlds-war/pulls/58"},"html":{"href":"https://github.com/polytopal/worlds-war/pull/58"},"issue":{"href":"https://api.github.com/repos/polytopal/worlds-war/issues/58"},"comments":{"href":"https://api.github.com/repos/polytopal/worlds-war/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/polytopal/worlds-war/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/polytopal/worlds-war/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/polytopal/worlds-war/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/polytopal/worlds-war/statuses/57e95edd532c38f2e3b8417c2458a11ce3bbbd3d"}}}}