-
Notifications
You must be signed in to change notification settings - Fork 281
Jodoyle29 patch 1 #1417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Jodoyle29 patch 1 #1417
Changes from 3 commits
df3c64a
504509d
d02bc22
b355602
4cd9166
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||||||
| from axelrod.action import Action | ||||||||||
| from axelrod.player import Player | ||||||||||
|
|
||||||||||
| C, D = Action.C, Action.D | ||||||||||
|
|
||||||||||
| class ProbabilisticHillClimb(Player): | ||||||||||
| """ | ||||||||||
| Defects with probability of 50%. | ||||||||||
| Every time the oppenent deffects, probability becomes '(100 + 1)/100', increasing by 1%. | ||||||||||
| Every time the opponent confesses, probability becomes '(100 - 1)/100', decreasing by 1%. | ||||||||||
|
||||||||||
| Every time the opponent confesses, probability becomes '(100 - 1)/100', decreasing by 1%. | |
| Every time the opponent cooperates, probability becomes '(100 - 1)/100', decreasing by 1%. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This will need to be modified throughout.)
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| self.probability = 0.5 | |
| self.probability_of_defection = 0.5 |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| MAX = 100 |
Based on the doctoring and that this is not a usable parameter I'd suggest just removing it.
If you did want to include it then you'd need to change it to match PEP8.
| MAX = 100 | |
| denominator = 100 |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if not len(opponent.history): # if opponent has no previous moves, confess on first move | |
| if len(opponent.history) == 0: # if opponent has no previous moves, cooperate on first move |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| self.probability += 1/MAX | |
| self.probability += 1 / MAX |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the comment is precise here. Could you describe the behaviour in the doctoring please.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| else: | |
| print("There has been an error") | |
| return self.history[-1] | |
| return self.history[-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This strategy defects with a given probability that changes over time. It's initial probability of defection is 0.5.