Stuck in Ring Bearer Level T.T


what’s the problems of my code? The soldiers did’t move until the peasant was shot dead

def findSoldierOffset(soldiers, i):
    soldier = soldiers[i]
    angle = i * 360 / len(soldiers)
    return radialToCartesian(5, angle)

# This function does the math to determine the offset a soldier should stand at.
def radialToCartesian(radius, degrees):
    radians = Math.PI / 180 * degrees
    xOffset = radius * Math.cos(radians)
    yOffset = radius * Math.sin(radians)
    return {"x": xOffset, "y": yOffset}

peasant = hero.findByType("peasant")[0]

# Use findByType to get an array of your soldiers.
soldiers = hero.findByType("soldiers")
while True:
    # Use a for-loop to iterate over range(len(soldiers)).
    for i in range(len(soldiers)):
        # Find the offset for a soldier.
        offset = findSoldierOffset(soldiers, i)
        # Add the offset.x and offset.y to the peasant's pos.x and pos.y.
        x = peasant.pos.x + offset.x
        y = peasant.pos.y + offset.y
        # Command the soldier to move to the new offset position.
        hero.command(soldiers[i], "move", {'x':x, 'y':y})
    # The hero should keep pace with the peasant!
    hero.move({"x": hero.pos.x + 0.2, "y": hero.pos.y})


I think you need to define x,y on those