Sarven Sum Fire trap calculation help


#1

I cannot do the level sarven sum with arithmetic for the traps.
code
’’'
whiteX = {‘x’:27, ‘y’:42}
redX = {‘x’:151 , ‘y’: 118}

minHazard = None
min = 9999
maxHazard = None
max = 0
index = 0
hazards = hero.findHazards()
while len(hazards) > index:
if hazards[index].value < min:
minHazard = hazards[index]
min = hazards[index].value
if hazards[index].value > max:
maxHazard = hazards[index]
max = hazards[index].value
index += 1
nn = min + max
hero.moveXY(27, 42)
hero.say(nn)
while True:
flag = hero.findFlag(“green”)
if flag:
hero.pickUpFlag(flag)
if hero.isReady(“summon-undead”):
hero.cast(“summon-undead”)
’’’


#2

I used triple batsticks but it does not format and my hero says the wrong sum


#3

I see. Those aren’t backticks. Those are single quotes.
Or you can click on the </> symbol. :slight_smile:


#4

ok thanks hellenar (must be 20 chars)


#5
whiteX = {'x':27, 'y':42}
redX = {'x':151 , 'y': 118}

minHazard = None
min = 9999
maxHazard = None
max = 0
index = 0
hazards = hero.findHazards()
while len(hazards) > index:
if hazards[index].value < min:
minHazard = hazards[index]
min = hazards[index].value
if hazards[index].value > max:
maxHazard = hazards[index]
max = hazards[index].value
index += 1
nn = min + max
hero.moveXY(27, 42)
hero.say(nn)
while True:
flag = hero.findFlag("green")
if flag:
hero.pickUpFlag(flag)
if hero.isReady("summon-undead"):
hero.cast("summon-undead")

#6

Where are all your indentations?


#7

O sorry.
here

# To disable the fire-traps add the lowest trap.value to the highest value.
# Move to the white X and say the answer to Kitty the cougar.
# Defeat all the ogres if you dare.
# Once all ogres are defeated move to the red X.
# Look out for potions to boost your health.

# To disable the fire-traps add the lowest trap.value to the highest value.
# Move to the white X and say the answer to Kitty the cougar.
# Defeat all the ogres if you dare.
# Once all ogres are defeated move to the red X.
# Look out for potions to boost your health.

whiteX = {'x':27, 'y':42}
redX = {'x':151 , 'y': 118}

minHazard = None
min = 9999
maxHazard = None
max = 0
index = 0
hazards = hero.findHazards()
while len(hazards) > index:
    if hazards[index].value < min:
        minHazard = hazards[index]
        min = hazards[index].value
        if hazards[index].value > max:
            maxHazard = hazards[index]
        max = hazards[index].value
    index += 1
nn = min + max
hero.moveXY(27, 42)
hero.say(nn)
while True:
    flag = hero.findFlag("green")
    if flag:
        hero.pickUpFlag(flag)
    if hero.isReady("summon-undead"):
        hero.cast("summon-undead")
        

        
    
    


#8

It says value is undefined


#9

Try defining hazard = hazards[index] first.