-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
created delivery drone class #547
base: master
Are you sure you want to change the base?
Conversation
app/base_robot.py
Outdated
value = eval(f"self.{coord_name} {simbl} {step}") | ||
setattr(self, coord_name, value) | ||
self.coords[coord_index] = value |
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.
value = eval(f"self.{coord_name} {simbl} {step}") | |
setattr(self, coord_name, value) | |
self.coords[coord_index] = value | |
value = eval(f"self.coords[{coord_index}] {simbl} {step}") | |
self.coords[coord_index] = value |
And totally remove x_pos, y_pos, z_pos just use indexes
app/base_robot.py
Outdated
self.x_pos = list_isinstance(coords, X_INDEX) | ||
self.y_pos = list_isinstance(coords, Y_INDEX) | ||
self.coords = [self.x_pos, self.y_pos] |
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.
self.x_pos = list_isinstance(coords, X_INDEX) | |
self.y_pos = list_isinstance(coords, Y_INDEX) | |
self.coords = [self.x_pos, self.y_pos] | |
self.coords = coords or [0, 0] |
Simplify this)
app/base_robot.py
Outdated
class BaseRobot: | ||
|
||
def __init__(self, name: str, weight: int, | ||
coords: list | None = None) -> None: |
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.
coords: list | None = None) -> None: | |
coords: list[int] | None = None) -> None: |
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.
add here and in all of the code
app/main.py
Outdated
self.current_load = current_load | ||
|
||
def hook_load(self, cargo: Cargo) -> None: | ||
if cargo.weight <= self.max_load_weight \ |
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.
use () instead of \
No description provided.