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

Scissors Laurel O #57

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

Scissors Laurel O #57

wants to merge 4 commits into from

Conversation

lolkinetzky
Copy link

No description provided.


class Decor(Item):
def __init__(self, condition=0):
super().__init__("Decor", condition)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great use of super()!

Comment on lines +30 to +33
self.inventory.remove(my_item)
them.inventory.append(my_item)
them.inventory.remove(their_item)
self.inventory.append(their_item)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the Vendor add & remove functions here.

def swap_first_item(self, them):
if len(self.inventory) == 0 or len(them.inventory) == 0:
return False
return self.swap_items(them, self.inventory[0], them.inventory[0])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great code re-use!

items_in_category = self.get_by_category(category)
if len(items_in_category) > 0:
#lambda lets me define a func in a single line
return max(items_in_category, key = lambda item: item.condition)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat solution! I appreciate seeing all of the different versions in your commit history.

@jbieniosek
Copy link

Great work on this project! Your code is very clean and readable. I had one minor comment about a place you could DRY up your code, but otherwise your use of helper functions throughout Vendor is excellent.

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