In the attack and defend methods in the AbstractRobot class, I had the hitCount set to equal to 4 in the last 'else if' statements like these:
else if (hitCount == 4) {
hitCount = 0;
attackedBodyPart = BodyPart.CHEST;
}
else if (hitCount == 4) {
hitCount = 0;
defendedBodyPart = BodyPart.CHEST;
}
But I couldn't get the last validation requirement. It was only after I had changed the hitCount to be >= 4 like this:
else if (hitCount >= 4) {
hitCount = 0;
attackedBodyPart = BodyPart.CHEST;
}
that I got the validation. But why does the hitCount parameter have to be >= 4 in the last 'else if'?