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

Herbivores and Сarnivores #3340

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

Conversation

Irina0401
Copy link

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.

Great job on implementing the Animal, Herbivore, and Carnivore classes! 🎉 The code meets the task requirements, and there are no critical issues affecting functionality. Although there was an error accessing the user code, the review summary indicates that the core functionality is correct. Keep up the good work, and consider checking accessibility issues for smoother future reviews. 😊

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

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.

Great job on implementing the Animal, Herbivore, and Carnivore classes! 🎉 Your code meets all the task requirements and constraints. The die method correctly handles the removal of animals from the alive array, and the bite method in the Carnivore class is implemented as expected. Keep up the excellent work, and continue to refine your skills! 😊

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

Comment on lines +10 to +11
if (this.health <= 0) {
Animal.alive = Animal.alive.filter((allAnimals) => allAnimals !== this);

Choose a reason for hiding this comment

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

The die method correctly filters the Animal.alive array to remove the current instance if its health is less than or equal to 0. This implementation is correct according to the task requirements.

}

class Carnivore extends Animal {
// write your code here
bite(target) {
if (target instanceof Herbivore && target.hidden === false) {

Choose a reason for hiding this comment

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

The bite method correctly checks if the target is an instance of Herbivore and is not hidden. This is a correct implementation according to the task requirements.

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