-
Notifications
You must be signed in to change notification settings - Fork 716
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
Conversation
* Add example for a TicTacToe bot
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. What to do if you already signed the CLAIndividual signers
Corporate signers
|
CLA signed! |
CLAs look good, thanks! |
python/boardgameio.py
Outdated
state = args[1] | ||
state_id = state['_stateID'] | ||
ctx = state['ctx'] | ||
player = ctx['actionPlayers'][0] |
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.
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
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 |
@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%). |
Also, please add *.pyc to the .gitignore file (again, happy to do these things myself if you open up permissions). |
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? |
No worries that it's directly on master. Yep, I think that should allow me to modify the PR. |
@francoijs Can you run pylint on your code and fix the warnings? |
* * 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
Checklist
master
).