Hi I have been trying to get this and I was looking and looking on if my code had something wrong but I don’t know.
# The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds. def chooseStrategy(): enemies = hero.findEnemies() enemy = self.findNearest(enemies) # If you can summon a griffin-rider, return "griffin-rider" if self.gold > self.costOf("griffin-rider") and enemy: return "griffin-rider" # If there is a fangrider on your side of the mines, return "fight-back" elif enemy and enemy.type == "fagrider" and self.distance (enemy) < 30: return "fight-back" # Otherwise, return "collect-coins" else: return "collect-coins" def commandAttack(): # Command your griffin riders to attack ogres. for griffin in self.findByType("griffin-rider"): if griffin: enemy = griffin.findNearestEnemy if enemy: self.command(griffin,"attack", enemy) pass def pickUpCoin(): # Collect coins coin = self. findNearest(self.findItems()) if coin: hero.move(coin.pos) pass def heroAttack(): # Your hero should attack fang riders that cross the minefield. enemy = self.findNearest(self.findEnemies()) if enemy and self.distanceTo(enemy) < 30: self.attack(enemy) pass while True: commandAttack() strategy = chooseStrategy() # Call a function, depending on what the current strategy is. if strategy == "griffin-rider": self.summon("griffin-rider") if strategy == "fight-back": commandAttack() if strategy == "collect-coins": pickUpCoin()
Thank you so much to anyone who can help.