-
Notifications
You must be signed in to change notification settings - Fork 25
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
Control Generator #110
base: master
Are you sure you want to change the base?
Control Generator #110
Conversation
Generates controls from a list of replays.
from carball.controls.controls import ControlsCreator | ||
import numpy as np | ||
|
||
class ReplayControlGen( BaseDataGenerator ): |
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 add a doc comment about what this generates specifically?
ControlsCreator().get_controls( game ) | ||
return game | ||
|
||
def sampleFrames( game, player, start, end ): |
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 add return values for these?
self.currentFrame = endFrame | ||
return sampleFrames( self.game, player, startFrame, endFrame ) | ||
|
||
def gameFromFile( replayName ): #Do not include file extension |
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 add types + move your comment to a python doc comment?
Removed unessicary/clunky functionality, added doc comments
Added return and parameter types
""" | ||
|
||
def __init__(self, filepaths: list): | ||
# filepaths:list of paths to replay files (no file extension), player: player index, frames: number of frames per output |
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.
put this inside the python docs or remove this comment
return False | ||
return True | ||
|
||
def _next(self) -> list: |
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 be List
and can be imported from typing
return game | ||
|
||
|
||
def getControls(player, frame: int) -> list: |
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.
what type is player?
Fixed List typing, added player typing removed extraneous comments and added non-extraneous comments.
pass | ||
|
||
def has_next(self): | ||
#If we are at the max frame, the last player and the last file then we have no more data to collect. |
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 we make this a python style comment
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 what that means...
""" | ||
Gets the controls of a player at a frame | ||
Arguments: | ||
player -- player object, game.players[p] |
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 is not the python style i am normally used to seeing.
try this instead
https://stackoverflow.com/questions/9195455/how-to-document-a-method-with-parameters
example:
`
:player Player
Description of player
Upgraded the cool factor by 10%
Generates controls from a list of replays.