I seem to fail at all fronts to protect Reynaldo

@TimmieT

First, please post your code with radiant, harmonious formatting (surrounding it in triple backticks) as explained in the FAQ

Second, please mention the level name – I remember a level about protecting a guy named Reynaldo, but I don’t recall the level name… that makes it harder to help you.


Now, about your code (as much as I can make it out):

Your summonGriffins function is missing essential things. It should be something like:

if self.gold >= costOf(...):       # comparison, colon
    self.summon(...)

The targetGold function is also flawed: you check item before you define it:

    [...]
    highValue=-1
    if not item in activeMoneyTarget:         # 'item' is not yet defined
        for item in items:                    # you only define 'item' here
            distanceToItemValue=(item.value/friend.distanceTo(item))
            [...]

You also don’t return anything if there is no coin at all (just in case).


The pickTarget function seems to be OK (although it could be optimized).


I let the others check the rest :wink: