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

Solution #874

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solution #874

wants to merge 1 commit into from

Conversation

AntonRzz
Copy link

@AntonRzz AntonRzz commented Jan 9, 2025

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Your code meets the task requirements and is well-structured overall! 🎉 While there are some areas for improvement, such as reducing repetition in the battle logic and knight initialization, these are minor and don't impact the functionality. Keep up the great work, and consider these suggestions for future enhancements to make your code even more maintainable and readable. 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +7 to +10
lancelot = Knight(**knightsconfig["lancelot"])
arthur = Knight(**knightsconfig["arthur"])
mordred = Knight(**knightsconfig["mordred"])
red_knight = Knight(**knightsconfig["red_knight"])

Choose a reason for hiding this comment

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

Consider refactoring the creation of Knight instances to avoid repetition. You could use a loop or a helper function to initialize the knights, which would make the code more maintainable and adhere to the DRY principle from the checklist.

Comment on lines +12 to +16
lancelot.take_damage(mordred.power)
mordred.take_damage(lancelot.power)

if red_knight["hp"] <= 0:
red_knight["hp"] = 0
arthur.take_damage(red_knight.power)
red_knight.take_damage(arthur.power)

Choose a reason for hiding this comment

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

The battle logic is repeated for each pair of knights. Consider creating a helper function to handle the battle between two knights. This would reduce code duplication and improve readability.

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