# The geometry of flowers possible bug?

``````# You now have the Ring of Flowers! You can do:
# toggleFlowers(True/False) - turns flowers on or off.
# setFlowerColor("random") - can also be "pink", "red", "blue", "purple", "yellow", or "white".

# Here are some functions for drawing shapes:
# x, y - center of the shape
# size - size of the shape (radius, side length)
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

def drawSquare(x, y, size):
hero.toggleFlowers(False)
cornerOffset = size / 2
hero.moveXY(x - cornerOffset, y - cornerOffset)
hero.toggleFlowers(True)
hero.moveXY(x + cornerOffset, y - cornerOffset)
hero.moveXY(x + cornerOffset, y + cornerOffset)
hero.moveXY(x - cornerOffset, y + cornerOffset)
hero.moveXY(x - cornerOffset, y - cornerOffset)

redX = {"x": 28, "y": 36}
whiteX = {"x": 44, "y": 36}

# Pick a color.
hero.setFlowerColor("white")
# Draw a size 10 circle at the redX.
drawCircle(redX, 10)
# Change the color!
hero.setFlowerColor("red")
# Draw a size 10 square at the whiteX.
drawSquare(whiteX, 10)
# Now experiment with drawing whatever you want!
``````

the last 4 lines of code are all i was suppose to touch in this exercise( I believe) changed my flower color, typed function that was given to me, gave it 2 arguements for POS and SIZE. not sure whats making this error appear. greatly appreciate any advise before hand =]

EDIT: my error i receive is…
line 14:moveXY’s arguement x should have type number, but got string: “[object Object]NaN”. moveXY requires 2 numbers as arguements. x is [object Object]NaN which is type ‘string’ not ‘number’.

EDIT: # Pick a color.
hero.setFlowerColor(“white”)

# Draw a size 10 circle at the redX.

drawCircle(redX, 10)

# Change the color!

hero.setFlowerColor(“red”)

# Draw a size 10 square at the whiteX.

drawSquare(whiteX, 10)

# Now experiment with drawing whatever you want!

If i remove all that and leave just the def functions there is no error, but obviously does not do anything either
giving no arguement also presents error

Bug? Are you sending 3 parameters to the drawSquare() function or 2? Be careful that you are actually doing what you think you are doing.

drawSquare wants an X coordinate, then a Y coordinate, then a size specifically.

hey what do you mean you that?

Hi, I’m not exactly sure what you’re asking here but if a topic is inactive as well as the users who participated in it please could you not post in it as you will not receive a reply from them.
Thanks

ok i won’t any more sorry

It’s fine.
Danny (20characters)