Решение не принимается, хотя я сравниваю все три параметра отдельно и за каждый присваиваю очко игроку. Функция возвращет true только если очки первого игрока больше очков второго. То есть при равных очках возвращается false. Почему решение не принимается?
package en.javarush.task.jdk13.task05.task0501;
/*
Cat carnage (1)
*/
public class Solution {
public static void main(String[] args) {
Cat duck = new Cat("duck", 1, 1, 1);
Cat dog = new Cat("dog", 2, 1, 1);
Cat horse = new Cat("horse", 1, 3, 3);
Cat elephant = new Cat("elephant", 2, 5, 5);
}
public static class Cat {
private String name;
private int age, weight, strength;
public Cat(String name, int age, int weight, int strength){
this.name = name;
this.age = age;
this.weight = weight;
this.strength = strength;
}
public boolean fight(Cat anotherCat) {
int thisScore = 0;
int anotherCatScore = 0;
if (this.weight > anotherCat.weight) thisScore++;
else if (this.weight < anotherCat.weight) anotherCatScore++;
if (this.age < anotherCat.age) thisScore++;
else if (this.age > anotherCat.age) anotherCatScore++;
if (this.strength > anotherCat.strength) thisScore++;
else if (this.strength < anotherCat.strength) anotherCatScore++;
return (thisScore > anotherCatScore);
}
}
}