Level - The Geometry of Flowers


#23

mine does not work.

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
self.toggleFlowers(False)
while angle <= Math.PI * 2:
newX = x + (size * Math.cos(angle))
newY = y + (size * Math.sin(angle))
self.moveXY({“x”: newX, “y”: newY})
self.toggleFlowers(True)
angle += 0.2

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

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

self.setFlowerColor(“red”)

Pick a color.

Draw a size 10 circle) at the redX.

drawCircle({“x”: 28, “y”: 36}, 10)

Change the color!

self.setFlowerColor(“white”)

Draw a size 10 square at the whiteX.

drawSquare({“x”: 44, “y”: 36}, 10)

Now experiment with drawing whatever you want!

it should make a size ten circle and square correctly but it tells me for this statement self.moveXY({“x”: newX, “y”: newY}) that i need to move to a x,y position. please help me


#24

Please post your code with radiant, harmonious formatting. At the current state it is not easily readable for us, so we can’t help you effectively.


#25

I believe I may have the same problem as aaronlee3, I’ve typed (i think) the correct code into the spaces suggested, then the pop-up tells me "Line 14:
moveXY requires 2 numbers as arguments. x is a NaN which is type ‘number’,
not ‘number’."
I did not change the original code except to try and fix the problem, then “reloaded” the code anyway, its still not working, thanks for advice in advance. =D

  • also using python as code

#26

@lighte Looks like you are passing a NaN value to the moveXY function—revise your code to make sure you are not dividing by zero or using non-number variables in your maths. Please post your code if you need further help.


#27

Thanks for the quick reply! The code that seems to have the issue is the original code,

def drawCircle(x, y, size):
    angle = 0
    self.toggleFlowers(False)
    while angle <= Math.PI * 2:
        newX = x + (size * Math.cos(angle))
        newY = y + (size * Math.sin(angle))
        self.moveXY(newX, newY) < [this is the line that the pop-up message indicates]
        self.toggleFlowers(True)
        angle += 0.2

drawCircle({"x": 28, "y": 36}, 10) < this is the code i entered to activate the line,if its my trigger thats the problem, I’m not sure what i need to change.
Thanks again!


#28

@lighte The problem is drawCircle({"x": 28, "y": 36}, 10), it should be drawCircle(28, 36, 10). Sorry for the late reply. :sweat_smile:

By the way, you can format your code by wrapping it with ```, see the FAQ for details. I’ve done it for you this time.


#29

This level can be beaten by using flags in real time, and while figuring out the full extent of this, you can even walk around the white x and make a square and get the goal for the circle, and you only have to make a shape around both x’s and the level can be completed, you should remove flags from being used in this level.


#31

Do you know the peasant is an avid gardener!


/but peasant.toggleFlowers(True) doesn’t work /


#32

Wow that’s so cool, does that work on any level when you have the flower ring and a peasant?


#33

I summoned a new peasant in the same level and he/she isn’t a gardener. It will be cool in levels with the flower ring all peasants have this and toggleFlowers ability.