Cloudrip Mountain Power Points level Python


Not sure whats going on with this level. My code works and the Hero iterates through each point and goes to the positive power points that are greater than 0. He Says VENI on the power point and gets an item to summon. But I cannnot get past the level because no skeletons are spawning and the grid seems to only have 2 power points that fit the greater than 0 and positive criteria. So I run out of time every time I run my code because I can’t “Find and defeat the skeletons” if they never spawn.


Could you post your code?

# You need to find and kill 3 skeletons.
# Skeletons and useful items can be summoned in the points of Power.
# You should move to the point and say the spell "VENI".
# To find the required points use the map from the wizard.
# 0 is a wrong point. Positive numbers are skeletons or useful items.

spell = "VENI"
# The map of points is represented as 2d array of numbers.
wizard = hero.findNearest(hero.findFriends())
powerMap = wizard.powerMap

# This function convert grid coordinates to x-y coordinates.
def convert(row, col):
    return {'x': 16 + col * 12, 'y': 16 + row * 12}

# You need loop through powerMap and find all positive numbers.
# First, loop through indexes of rows.
for i in range(len(powerMap)):
    # Each row is an array. Iterate through it.
    for j in range(len(powerMap[i])):
        # Get the value of the i-th row and j-th column.
        pointValue = powerMap[i][j]
        # If it's a positive number:
        if pointValue > 0 and pointValue % 2 == 0:
            # Use the 'convert' function to get coordinates.
            pos = convert(i,j)
            # Move there, say "VENI", fight or pick up an item.
            hero.moveXY(pos.x, pos.y)
            item = hero.findNearest(hero.findItems())
            enemy = hero.findNearest(hero.findEnemies())
            if enemy:
                hero.moveXY(item.pos.x, item.pos.y)

I have my hero say the pointValue and next so I know what point is a positive number and I can keep track of which point he is on.


So 1 isn’t a positive number :wink:


I don’t know why I got it stuck in my head that it was positive even numbers.