-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Improved battle_against
API
#657
base: master
Are you sure you want to change the base?
Improved battle_against
API
#657
Conversation
7d8bd5b
to
524b047
Compare
…ove-battle-against-api
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #657 +/- ##
==========================================
+ Coverage 83.38% 85.44% +2.06%
==========================================
Files 39 42 +3
Lines 3918 4419 +501
==========================================
+ Hits 3267 3776 +509
+ Misses 651 643 -8 |
…ove-battle-against-api
@hsahovic this one's ready for you! |
src/poke_env/player/player.py
Outdated
@@ -692,7 +694,9 @@ async def _ladder(self, n_games: int): | |||
perf_counter() - start_time, | |||
) | |||
|
|||
async def battle_against(self, opponent: "Player", n_battles: int = 1): | |||
async def battle_against( |
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.
Can you update the docstring?
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.
Does this make n_battles
a required named argument? If so i'd prefer opponent
to be either a player or a list of players, and keep n_battles
from requiring to be named.
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.
Updated docstring: 411a469
No need to worry, n_battles is still an optional argument - I'm pretty sure the only requirement is that all the opponents are listed before n_battles is specified, and you need to explicitly say "n_battles=..." in order to specify the integer from the Player objects.
src/poke_env/player/player.py
Outdated
to_id_str(self.username), n_battles, opponent.next_team | ||
), | ||
) | ||
results[opponent.username] = (self.win_rate, opponent.win_rate) |
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 should bot be part of this method - reporting results is unrelated to starting battles. Similarly, resetting the stored battles after the battles are done would be counterintuitive and make for a bad API.
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.
Good point! Here you go: f17c415
@hsahovic alright I've attended to your thoughts, let me know what you think! Got some nice improvements in, thanks for the review! |
…ove-battle-against-api
No description provided.