-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
base: master
Are you sure you want to change the base?
Conversation
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.
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! ✨
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.
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! ✨
if (this.health <= 0) { | ||
Animal.alive = Animal.alive.filter((allAnimals) => allAnimals !== this); |
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.
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) { |
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.
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.
No description provided.