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

Control Generator #110

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Control Generator #110

wants to merge 6 commits into from

Conversation

JayTheYggdrasil
Copy link

Generates controls from a list of replays.

Generates controls from a list of replays.
from carball.controls.controls import ControlsCreator
import numpy as np

class ReplayControlGen( BaseDataGenerator ):
Copy link
Member

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 ):
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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:
Copy link
Member

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:
Copy link
Member

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.
Copy link
Member

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

Copy link
Author

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]
Copy link
Member

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%
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.

2 participants