Skip to content
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

Human Strategy #732

Merged
merged 45 commits into from
Oct 12, 2016
Merged

Human Strategy #732

merged 45 commits into from
Oct 12, 2016

Conversation

meatballs
Copy link
Member

A strategy that prompts for keyboard input rather than deriving its own action.

closes #728

Copy link
Member

@drvinceknight drvinceknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny changes and one question. Looks good to me :)

class Human(Player):
"""
A strategy that prompts for keyboard input rather than deriving its own
action.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps can we add:

This is to be used interactively and is not expected to be used like the other strategies.

Not sure if that's quite the right wording but I think having something to kind of say: "if you're just poking around and having a look, this strategy is indeed a bit 'weird'"...

name: string
The name of the human player
c_symbol: string
The symbol to denote cooperation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps:

The symbol to denote cooperation at the interactive prompt

?

c_symbol: string
The symbol to denote cooperation
d_symbol: string
The symbol to denote defection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above?

@@ -72,6 +72,9 @@ Here are the docstrings of all the strategies in the library.
.. automodule:: axelrod.strategies.handshake
:members:
:undoc-members:
.. automodule:: axelrod.strategies.human
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the answer to this question but should this be documented/listed in all_strategies? I wonder if it would be best left outside of it as that index gives a nice list of 'research' strategies (the cheaters being an immediate counter example to that point of view). No strong feelings from me just think it's worth thinking about.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take it out whilst we think further....

>>> match.play() #doctest: +SKIP

You will be prompted for the action to play at each turn and will be able to
access the results of the match as described in :ref:`creating_matches`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth showing some example of the prompt? It needn't be too extensive and it would not include the >>> so it wouldn't be picked up by the doctests. So something like (after what you have already written):


This will then prompt the user for inputs of C or D:

Starting new match
Turn 1 action [C or D] for me: C

Turn 1: me played C, opponent played C
Turn 2 action [C or D] for me: D

Turn 2: me played D, opponent played C
Turn 3 action [C or D] for me: C
[('C', 'C'), ('C', 'D'), ('D', 'C')]

after this the match object can be manipulated as described in http://axelrod.readthedocs.io/en/latest/tutorials/getting_started/match.html


Copy link
Member

@drvinceknight drvinceknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making those changes. 👍

@marcharper
Copy link
Member

This is 👍 from me, just the one simple question.

toolbar = None
print_statement = '{}Starting new match'.format(linesep)

return {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to return a dictionary rather than a tuple? Just curious.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having the readable keys and I was too lazy to create a NamedTuple!!

@marcharper marcharper merged commit c89aeaa into master Oct 12, 2016
@meatballs meatballs deleted the issue-728 branch October 12, 2016 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Human Strategy
3 participants