I submitted my code into harrowlands. I managed to beat the simple AI, but since then I haven’t even won once! I am ranked last. The next highest score is over 1,000 mine…
What am I doing wrong?
My Code
enemies = self.findEnemies()
simpleAI = []
for enemy in enemies:
if enemy.health == self.health and enemy.type == self.type:
simpleAI.append(enemy)
self.summon("soldier")
self.summon("soldier")
if simpleAI[0]:
loop:
if self.isReady("throw"):
self.throw(simpleAI[0])
else:
self.attack(enemy)
friends = self.findFriends()
for friend in friends:
self.command(friend, "attack", simpleAI[0])
else:
loop:
enemy = self.findNearest(self.findByType("sand-yak"))
friends = self.findFriends()
for friend in friends:
self.command(friend, "attack", self)
if self.isReady('throw'):
self.throw(enemy)
else:
self.attack(self)