fire reaping help. I need help with my code, my griffin-riders are not responding to the command and also my code maybe has other problems.HELP
def chooseStrategy():
enemies = hero.findEnemies()
# If you can summon a griffin-rider, return "griffin-rider"
if hero.gold > hero.costOf("griffin-rider"):
return "griffin-rider"
# If there is a fangrider on your side of the mines, return "fight-back"
enemy = hero.findNearestEnemy()
if enemy and enemy.type == "fangrider":
return "fight-back"
# Otherwise, return "collect-coins"
return "collect-coins"
def commandAttack():
# Command your griffin riders to attack ogres.
friend = hero.findFriends()
friends = hero.findFriends()
if friend in friends:
hero.command(friend, "attack", enemy)
for enemy in enemies:
hero.command(friend, "attack", enemy)
pass
def pickUpCoin():
# Collect coins
coin = hero.findNearestItem()
if coin:
hero.move(coin.pos)
pass
def heroAttack():
# Your hero should attack fang riders that cross the minefield.
if enemy and enemy.pos > hero.pos:
hero.attack(enemy)
pass
while True:
commandAttack()
strategy = chooseStrategy()
# Call a function, depending on what the current strategy is.
if strategy == "griffin-rider":
hero.summon("griffin-rider")
if strategy == "fight-back":
heroAttack()
if strategy == "collect-coins":
pickUpCoin()