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

Python Bot base class (#98) #195

Merged
merged 11 commits into from
Jun 8, 2018
Merged

Conversation

francoijs
Copy link
Contributor

  • Add example for a TicTacToe bot

Checklist

  • Use a separate branch in your local repo (not master).
  • Test coverage is 100% (or you have a story for why it's ok).

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@francoijs francoijs mentioned this pull request May 10, 2018
3 tasks
@coveralls
Copy link

coveralls commented May 10, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling bab5e03 on francoijs:master into b5028ab on google:master.

@francoijs
Copy link
Contributor Author

CLA signed!

@googlebot
Copy link

CLAs look good, thanks!

state = args[1]
state_id = state['_stateID']
ctx = state['ctx']
player = ctx['actionPlayers'][0]
Copy link
Member

Choose a reason for hiding this comment

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

The semantics of actionPlayers is that any player in the set is allowed to play. So you should be checking if:

self.bot.player_id in actionPlayers

instead of just looking at the first value

@vdfdev
Copy link
Contributor

vdfdev commented May 11, 2018

Great work! How are you planning to connect this with the javascript backend?

EDIT: nevermind I realize you connect using socket io! That's great! It is a much simpler solution than what I was thinking! Kudos :D

@nicolodavis nicolodavis changed the title * Add base class for Python bot development (#98) Python Bot base class (#98) May 16, 2018
@nicolodavis
Copy link
Member

@francoijs Looks great! I have some minor formatting fixes etc. that I can add to your branch directly if you open up permissions on it.

Also, would you mind adding some unit tests for the base class? (the JS code in this repo has 100% coverage, so it would be a bit jarring for Python to have 0%).

@nicolodavis
Copy link
Member

Also, please add *.pyc to the .gitignore file (again, happy to do these things myself if you open up permissions).

@francoijs
Copy link
Contributor Author

francoijs commented May 16, 2018

Thanks for the review! You should now be collaborator on my fork of boardgame.io, is it enough so that you can modify the PR?
BTW, the PR was made directly on master instead of a separate branch, I hope it's not a problem.
I will be glad to add some unit-tests, but it may take some time since I will be off for the next 2 weeks.

@nicolodavis
Copy link
Member

No worries that it's directly on master. Yep, I think that should allow me to modify the PR.

@nicolodavis
Copy link
Member

@francoijs Can you run pylint on your code and fix the warnings?

@nicolodavis nicolodavis merged commit 99b9844 into boardgameio:master Jun 8, 2018
amitport pushed a commit to amitport/boardgame.io that referenced this pull request Jun 16, 2018
* * Add base class for Python bot development (boardgameio#98)
* Add example for a TicTacToe bot

* python bot: check that player_id is one of 'actionPlayers' before playing

* Add a bunch of unit-tests for the python client

* Add instructions for coverage of python client unit-tests (90%)

* pylint options

* fix pylint warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants