[SOLVED] I think there's a bug in "Geometry of Flowers"

I was trying Geometry of Flowers and I did everything it told me to
The problem the game is having is with the code that was originally there

def drawCircle(x, y, size):
    angle = 0
    hero.toggleFlowers(False)
    while angle <= Math.PI * 2:
        newX = x + (size * Math.cos(angle))
        newY = y + (size * Math.sin(angle))
        hero.moveXY(newX, newY)
        hero.toggleFlowers(True)
        angle += 0.2

was given

The line it doesn’t like is hero.moveXY(newX, newY)

I am having the same problem as you. I look on others and they had different problems.

I’m having that problem did you ever figure it out?

same

def drawCircle(x, y, size):
    angle = 0
    hero.toggleFlowers(False)
    while angle <= Math.PI * 2:
        newX = x + (size * Math.cos(angle))
        newY = y + (size * Math.sin(angle))
        hero.moveXY(newX, newY)
        hero.toggleFlowers(True)
        angle += 0.2

@Hydrobolic @Chaboi_3000 could you help here? you must have passed this level before, how?

I have had no difficulties solving this level. Does your equipment provide hero.moveXY() method? Do you have a more specific error?



As you can see, the game’s given code has a error. Are you using this code? do you have gear that lets you use variables/strings in moveXY?

@Hydrobolic

(The code that has an error was given by the game, here’s a photo of the code right after resetting the code, with an error)


![image|690x227](upload://sw@Hydrobolic bxyJPEGZCealpO.jpeg)
@hydrobolic

error with the last photo lol

You are experiencing the effects of JavaScript in Python, a side effect of CodeCombat’s not quite correct parser.

Note how the drawCircle function is defined to take an x and y coordinates in addition to the size, but you are passing a {x: ..., y: ...} position instead. As a result, inside the function, x is a position, y is 10, and size is undefined, none of which are right.

You’ll need to pass the x and y coordinates individually or change the function defintion.
drawCircle(redX.x, redX.y, 10)

ok thanks Preformatted text

drawCircle(redX.pos.x, redX.pos.y, 10)

it now says cannot read property ‘x’ of undefined

{x: ..., y: ...} only has x and y attributes

oh im stupid sorry Preformatted text

This is now officially solved