{"action":"created","comment":{"url":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/comments/63340394","id":63340394,"diff_hunk":"@@ -0,0 +1,49 @@\n+from axelrod import Actions, Player, Game\n+\n+C, D = Actions.C, Actions.D\n+\n+\n+class Adaptive(Player):\n+    \"\"\"Start with a specific sequence of C and D, then play the strategy that\n+    has worked best, recalculated each turn.\"\"\"\n+\n+    name = 'Adaptive'\n+    classifier = {\n+        'memory_depth': float('inf'),  # Long memory\n+        'stochastic': False,\n+        'makes_use_of': set(),\n+        'inspects_source': False,\n+        'manipulates_source': False,\n+        'manipulates_state': False\n+    }\n+\n+    def __init__(self):\n+        Player.__init__(self)\n+        self.initial_plays = [C] * 6 + [D] * 5\n+        self.reset()\n+\n+    def score_last_round(self, opponent):\n+        try:\n+            game = self.match_attributes[\"game\"]\n+        except AttributeError:\n+            game = Game()\n+        if len(self.history):\n+            last_round = (self.history[-1], opponent.history[-1])\n+            scores = game.score(last_round)\n+            self.scores[last_round[0]] += scores[0]\n+\n+    def strategy(self, opponent):\n+        # Update scores from the last play\n+        self.score_last_round(opponent)\n+        # Begin by playing the sequence C,C,C,C,C,C,D,D,D,D,D","path":"axelrod/strategies/adaptive.py","position":39,"original_position":38,"commit_id":"0cff3ca068470c7a1cc70531669be0400292c3a9","original_commit_id":"168ad6a6d0976312da1c80719d4c6980740d38b8","user":{"login":"meatballs","id":338846,"avatar_url":"https://avatars.githubusercontent.com/u/338846?v=3","gravatar_id":"","url":"https://api.github.com/users/meatballs","html_url":"https://github.com/meatballs","followers_url":"https://api.github.com/users/meatballs/followers","following_url":"https://api.github.com/users/meatballs/following{/other_user}","gists_url":"https://api.github.com/users/meatballs/gists{/gist_id}","starred_url":"https://api.github.com/users/meatballs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meatballs/subscriptions","organizations_url":"https://api.github.com/users/meatballs/orgs","repos_url":"https://api.github.com/users/meatballs/repos","events_url":"https://api.github.com/users/meatballs/events{/privacy}","received_events_url":"https://api.github.com/users/meatballs/received_events","type":"User","site_admin":false},"body":"or, perhaps, using the initial_sequence decorator?","created_at":"2016-05-16T11:25:47Z","updated_at":"2016-05-16T11:25:47Z","html_url":"https://github.com/Axelrod-Python/Axelrod/pull/591#discussion_r63340394","pull_request_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/591","_links":{"self":{"href":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/comments/63340394"},"html":{"href":"https://github.com/Axelrod-Python/Axelrod/pull/591#discussion_r63340394"},"pull_request":{"href":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/591"}}},"pull_request":{"url":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/591","id":70105878,"html_url":"https://github.com/Axelrod-Python/Axelrod/pull/591","diff_url":"https://github.com/Axelrod-Python/Axelrod/pull/591.diff","patch_url":"https://github.com/Axelrod-Python/Axelrod/pull/591.patch","issue_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/issues/591","number":591,"state":"open","locked":false,"title":"New Strategies","user":{"login":"marcharper","id":203345,"avatar_url":"https://avatars.githubusercontent.com/u/203345?v=3","gravatar_id":"","url":"https://api.github.com/users/marcharper","html_url":"https://github.com/marcharper","followers_url":"https://api.github.com/users/marcharper/followers","following_url":"https://api.github.com/users/marcharper/following{/other_user}","gists_url":"https://api.github.com/users/marcharper/gists{/gist_id}","starred_url":"https://api.github.com/users/marcharper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcharper/subscriptions","organizations_url":"https://api.github.com/users/marcharper/orgs","repos_url":"https://api.github.com/users/marcharper/repos","events_url":"https://api.github.com/users/marcharper/events{/privacy}","received_events_url":"https://api.github.com/users/marcharper/received_events","type":"User","site_admin":false},"body":"This PR contains the following strategies:\r\n* Adaptive\r\n* Handshake\r\n* CyclerDC and CyclerDDC (used in the literature)\r\n* 8 Finite State Machine strategies: Fortress3, Fortress4, Predator, Raider, Ripoff, SolutionB1, SolutionB5, Thumper\r\n\r\nI'm open to ideas about better testing for the FSM strategies.","created_at":"2016-05-14T22:35:28Z","updated_at":"2016-05-16T11:25:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ccf7051b67f2bf02283a48e24d96fb95d1810690","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/591/commits","review_comments_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/591/comments","review_comment_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/issues/591/comments","statuses_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/statuses/0cff3ca068470c7a1cc70531669be0400292c3a9","head":{"label":"Axelrod-Python:strategies","ref":"strategies","sha":"0cff3ca068470c7a1cc70531669be0400292c3a9","user":{"login":"Axelrod-Python","id":11720937,"avatar_url":"https://avatars.githubusercontent.com/u/11720937?v=3","gravatar_id":"","url":"https://api.github.com/users/Axelrod-Python","html_url":"https://github.com/Axelrod-Python","followers_url":"https://api.github.com/users/Axelrod-Python/followers","following_url":"https://api.github.com/users/Axelrod-Python/following{/other_user}","gists_url":"https://api.github.com/users/Axelrod-Python/gists{/gist_id}","starred_url":"https://api.github.com/users/Axelrod-Python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Axelrod-Python/subscriptions","organizations_url":"https://api.github.com/users/Axelrod-Python/orgs","repos_url":"https://api.github.com/users/Axelrod-Python/repos","events_url":"https://api.github.com/users/Axelrod-Python/events{/privacy}","received_events_url":"https://api.github.com/users/Axelrod-Python/received_events","type":"Organization","site_admin":false},"repo":{"id":30959449,"name":"Axelrod","full_name":"Axelrod-Python/Axelrod","owner":{"login":"Axelrod-Python","id":11720937,"avatar_url":"https://avatars.githubusercontent.com/u/11720937?v=3","gravatar_id":"","url":"https://api.github.com/users/Axelrod-Python","html_url":"https://github.com/Axelrod-Python","followers_url":"https://api.github.com/users/Axelrod-Python/followers","following_url":"https://api.github.com/users/Axelrod-Python/following{/other_user}","gists_url":"https://api.github.com/users/Axelrod-Python/gists{/gist_id}","starred_url":"https://api.github.com/users/Axelrod-Python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Axelrod-Python/subscriptions","organizations_url":"https://api.github.com/users/Axelrod-Python/orgs","repos_url":"https://api.github.com/users/Axelrod-Python/repos","events_url":"https://api.github.com/users/Axelrod-Python/events{/privacy}","received_events_url":"https://api.github.com/users/Axelrod-Python/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Axelrod-Python/Axelrod","description":"A research tool to run Iterated Prisoner's Dilemma tournaments","fork":false,"url":"https://api.github.com/repos/Axelrod-Python/Axelrod","forks_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/forks","keys_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/teams","hooks_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/hooks","issue_events_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/issues/events{/number}","events_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/events","assignees_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/assignees{/user}","branches_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/branches{/branch}","tags_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/tags","blobs_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/git/refs{/sha}","trees_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/statuses/{sha}","languages_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/languages","stargazers_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/stargazers","contributors_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/contributors","subscribers_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/subscribers","subscription_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/subscription","commits_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/commits{/sha}","git_commits_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/git/commits{/sha}","comments_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/comments{/number}","issue_comment_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/issues/comments{/number}","contents_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/contents/{+path}","compare_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/merges","archive_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/downloads","issues_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/issues{/number}","pulls_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls{/number}","milestones_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/milestones{/number}","notifications_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/labels{/name}","releases_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/releases{/id}","deployments_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/deployments","created_at":"2015-02-18T09:37:17Z","updated_at":"2016-05-13T11:54:52Z","pushed_at":"2016-05-16T06:07:32Z","git_url":"git://github.com/Axelrod-Python/Axelrod.git","ssh_url":"git@github.com:Axelrod-Python/Axelrod.git","clone_url":"https://github.com/Axelrod-Python/Axelrod.git","svn_url":"https://github.com/Axelrod-Python/Axelrod","homepage":"http://axelrod.readthedocs.org/","size":137540,"stargazers_count":63,"watchers_count":63,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":20,"forks":47,"open_issues":20,"watchers":63,"default_branch":"master"}},"base":{"label":"Axelrod-Python:master","ref":"master","sha":"7e19f650760adc11fa99243e072125c975c69f1b","user":{"login":"Axelrod-Python","id":11720937,"avatar_url":"https://avatars.githubusercontent.com/u/11720937?v=3","gravatar_id":"","url":"https://api.github.com/users/Axelrod-Python","html_url":"https://github.com/Axelrod-Python","followers_url":"https://api.github.com/users/Axelrod-Python/followers","following_url":"https://api.github.com/users/Axelrod-Python/following{/other_user}","gists_url":"https://api.github.com/users/Axelrod-Python/gists{/gist_id}","starred_url":"https://api.github.com/users/Axelrod-Python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Axelrod-Python/subscriptions","organizations_url":"https://api.github.com/users/Axelrod-Python/orgs","repos_url":"https://api.github.com/users/Axelrod-Python/repos","events_url":"https://api.github.com/users/Axelrod-Python/events{/privacy}","received_events_url":"https://api.github.com/users/Axelrod-Python/received_events","type":"Organization","site_admin":false},"repo":{"id":30959449,"name":"Axelrod","full_name":"Axelrod-Python/Axelrod","owner":{"login":"Axelrod-Python","id":11720937,"avatar_url":"https://avatars.githubusercontent.com/u/11720937?v=3","gravatar_id":"","url":"https://api.github.com/users/Axelrod-Python","html_url":"https://github.com/Axelrod-Python","followers_url":"https://api.github.com/users/Axelrod-Python/followers","following_url":"https://api.github.com/users/Axelrod-Python/following{/other_user}","gists_url":"https://api.github.com/users/Axelrod-Python/gists{/gist_id}","starred_url":"https://api.github.com/users/Axelrod-Python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Axelrod-Python/subscriptions","organizations_url":"https://api.github.com/users/Axelrod-Python/orgs","repos_url":"https://api.github.com/users/Axelrod-Python/repos","events_url":"https://api.github.com/users/Axelrod-Python/events{/privacy}","received_events_url":"https://api.github.com/users/Axelrod-Python/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Axelrod-Python/Axelrod","description":"A research tool to run Iterated Prisoner's Dilemma tournaments","fork":false,"url":"https://api.github.com/repos/Axelrod-Python/Axelrod","forks_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/forks","keys_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/teams","hooks_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/hooks","issue_events_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/issues/events{/number}","events_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/events","assignees_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/assignees{/user}","branches_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/branches{/branch}","tags_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/tags","blobs_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/git/refs{/sha}","trees_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/statuses/{sha}","languages_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/languages","stargazers_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/stargazers","contributors_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/contributors","subscribers_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/subscribers","subscription_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/subscription","commits_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/commits{/sha}","git_commits_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/git/commits{/sha}","comments_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/comments{/number}","issue_comment_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/issues/comments{/number}","contents_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/contents/{+path}","compare_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/merges","archive_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/downloads","issues_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/issues{/number}","pulls_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls{/number}","milestones_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/milestones{/number}","notifications_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/labels{/name}","releases_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/releases{/id}","deployments_url":"https://api.github.com/repos/Axelrod-Python/Axelrod/deployments","created_at":"2015-02-18T09:37:17Z","updated_at":"2016-05-13T11:54:52Z","pushed_at":"2016-05-16T06:07:32Z","git_url":"git://github.com/Axelrod-Python/Axelrod.git","ssh_url":"git@github.com:Axelrod-Python/Axelrod.git","clone_url":"https://github.com/Axelrod-Python/Axelrod.git","svn_url":"https://github.com/Axelrod-Python/Axelrod","homepage":"http://axelrod.readthedocs.org/","size":137540,"stargazers_count":63,"watchers_count":63,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":20,"forks":47,"open_issues":20,"watchers":63,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/591"},"html":{"href":"https://github.com/Axelrod-Python/Axelrod/pull/591"},"issue":{"href":"https://api.github.com/repos/Axelrod-Python/Axelrod/issues/591"},"comments":{"href":"https://api.github.com/repos/Axelrod-Python/Axelrod/issues/591/comments"},"review_comments":{"href":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/591/comments"},"review_comment":{"href":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Axelrod-Python/Axelrod/pulls/591/commits"},"statuses":{"href":"https://api.github.com/repos/Axelrod-Python/Axelrod/statuses/0cff3ca068470c7a1cc70531669be0400292c3a9"}}}}