Skip to content

completed - #3913

Open
Kirky359 wants to merge 2 commits into
mate-academy:masterfrom
Kirky359:develop
Open

Kirky359 wants to merge 2 commits into
mate-academy:masterfrom
Kirky359:develop

Conversation

@Kirky359

Copy link
Copy Markdown

No description provided.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

REQUEST_CHANGES

Thank you for your hard work on this! Your implementation of the class hierarchy and method logic is solid, but there are critical blockers that must be addressed before approval:

Issues to Fix:

  1. Incorrect Removal of Dead Animals from Animal.alive

    • The requirements and checklist explicitly state that you must use the filter method to update Animal.alive and remove dead animals (those with health <= 0).
    • Currently, you are using indexOf and splice inside the checkIfAlive method. This does not meet the requirement.
    • How to fix: Replace your removal logic with:
      Animal.alive = Animal.alive.filter(animal => animal.health > 0);
      Do this wherever you need to remove dead animals from the array.
  2. Animal.alive May Contain Dead Animals

    • The removal of dead animals only happens when checkIfAlive is called (e.g., after bite). If an animal's health is set to 0 by other means, it may remain in Animal.alive.
    • How to fix: Ensure that Animal.alive is always updated after any action that could cause an animal to die, not just after bite or checkIfAlive.

Why this matters:

  • These issues violate explicit checklist items and core requirements. They could cause your code to fail tests or behave incorrectly in edge cases.

Next Steps:

  • Refactor your code to use filter for updating Animal.alive.
  • Make sure dead animals are always removed immediately after their health drops to 0 or below, regardless of how that happens.

Once you address these, your code should be fully compliant. You're very close—keep up the good work!


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

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/herbivoresAndCarnivores.js Outdated
Comment on lines +14 to +17
const index = Animal.alive.indexOf(this);

if (index !== -1) {
Animal.alive.splice(index, 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item: 'The Animal.alive array must be updated using the filter method to remove dead animals (those with health <= 0).' You are using indexOf and splice instead of filter.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

All core requirements and checklist items are fully met. Your implementation of the Animal, Herbivore, and Carnivore classes is correct, uses ES6 class syntax, and handles all required behaviors such as hiding, biting, and maintaining the Animal.alive array with the filter method. There are no critical or blocking issues—everything functions as specified. Great job on a clean, efficient, and standards-compliant solution!


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

Footnotes

  1. Rate AI review example

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