This error makes no sense to me. This seems like more of an issue with the website than my code but I could be wrong.
EDIT: I was wrong, I just had my iteration inside the wrong loop
This error makes no sense to me. This seems like more of an issue with the website than my code but I could be wrong.
EDIT: I was wrong, I just had my iteration inside the wrong loop
// Use while loops to pick out the ogre
int main() {
while(true) {
auto enemies = hero.findEnemies();
int enemyIndex = 0;
// Wrap this logic in a while loop to attack all enemies.
// Find the array's length with: enemies.size()
while (enemyIndex < enemies.size()){
auto enemy = enemies[enemyIndex];
// "!=" means "not equal to."
if (enemy.type != "sand-yak") {
// While the enemy's health is greater than 0, attack it!
while(enemy.health>0) {
hero.attack(enemy);
}
enemyIndex +=1;
}
}
// Between waves, move back to the center.
hero.moveXY(40, 33);
}
return 0;
}