# Official Flower Grove Topic

#80

I got a suggestion: Make the time infinite and when you stop the level end.

#81

I don’t have Pender. I’m not a subscriber

#82

What if you’re in the middle of a masterpiece that’s way over 1,000 flowers? Good idea though.

#83

Thank. You me an idea for a suggestion: They should add a leaderboard that show you which creation have the most flower in it.

#84

#85

have you tried using faster characters?

#86

This reminds me of instregram(srry) lol

#87

@MiniGru that was so cool

#88

Code (includes a cubic Bézier curve drawing function!)
``````# p1 is start, p4 is end
# p2 and p3 are for approach. the curve usually never hits these points.
def drawCubicBezier(p1, p2, p3, p4):
hero.toggleFlowers(False)
hero.moveXY(p1.x, p1.y)
hero.toggleFlowers(True)
b = {'x': p1.x, 'y': p1.y}
# The further the distance between points, the smaller the tStep.
tStep = (distance(p1,p2) + distance(p2,p3) + distance(p3,p4))**-1.0
for t in range(0, 1, tStep):
b.x = ((1 - t)**3 * p1.x) + (3 * (1 - t)**2 * t * p2.x) + (3 * (1 - t) * t**2 * p3.x) + (t**3 * p4.x)
b.y = ((1 - t)**3 * p1.y) + (3 * (1 - t)**2 * t * p2.y) + (3 * (1 - t) * t**2 * p3.y) + (t**3 * p4.y)
hero.moveXY(b.x, b.y)

def distance(p1, p2):
return ((p1.x-p2.x)**2 + (p1.y-p2.y)**2)**0.5

# x and y are the coordinates for the center
# size is the width from one end of the mouth to the other
def drawSmiley(x, y, size):
bezCurves = [ # this is a 2D array of positions
# Mouth
[{"x": x - size*0.5,  "y": y},
{"x": x - size*0.35, "y": y - size*0.7},
{"x": x + size*0.35, "y": y - size*0.7},
{"x": x + size*0.5,  "y": y}],
# Right eye
[{"x": x + size*0.32, "y": y + size*0.35},
{"x": x + size*0.26, "y": y + size*0.65},
{"x": x + size*0.18, "y": y + size*0.65},
{"x": x + size*0.12, "y": y + size*0.35}],
# Left eye
[{"x": x - size*0.12, "y": y + size*0.35},
{"x": x - size*0.18, "y": y + size*0.65},
{"x": x - size*0.26, "y": y + size*0.65},
{"x": x - size*0.32, "y": y + size*0.35}]
]
for i in range(len(bezCurves)):
drawCubicBezier(
bezCurves[i][0],
bezCurves[i][1],
bezCurves[i][2],
bezCurves[i][3]
)

def xyToPos(x, y):
return {'x': x, 'y': y}

colors = ["pink", "red", "yellow", "blue", "purple", "white"]
for col in range(1,5+1):
for row in range(1,4+1):
hero.setFlowerColor(
colors[Math.ceil(Math.random()*len(colors))-1])
drawSmiley(x = col*25 + 10, y = 125*((col+1)%2) + row*25*(-1)**((col+1)%2) + 10, size = 15)

hero.toggleFlowers(False)
``````

#89

There is a forest flower grove

#90

# Meta-Flowers

Code
``````# angleOffset: the offset (in radians) starting from rad=0 and going counterclockwise that determines where the apex of the first petal of the flower is drawn
angleStep = (Math.PI*2/petals) / 12
hero.toggleFlowers(False)
hero.moveXY(
hero.toggleFlowers(True)
for angle in range(angleStep, Math.PI*2, angleStep):
# remember to add angleOffset to angle when calculating
angleThisStep = angle + angleOffset
hero.moveXY(
if centerCircle:
hero.setFlowerColor("white")
hero.toggleFlowers(False)

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 distance(p1, p2):
return ((p1.x-p2.x)**2 + (p1.y-p2.y)**2)**0.5

oldPos = []
newPos = {
'x': None,
'y': None}
colors = ["red", "blue", "yellow", "purple", "blue", "yellow", "purple"]
for i in range(15):
# make flowers not too close to each other
for k in range(7): # seven passes before quitting
good = True
newPos.x = 70*Math.random() + 50
newPos.y = 50*Math.random() + 50
# loop through each oldPos to make sure newPos isn't too close to any of them
for n in range(len(oldPos)):
if distance(newPos,oldPos[n]) < 20:
good = False
break
if good:
break
hero.setFlowerColor(colors[Math.ceil(Math.random()*len(colors)) - 1])
drawMetaFlower(
newPos.x,
newPos.y,
angleOffset = Math.random()*Math.PI*2/5,
centerCircle = (i+1)%2)
oldPos[i] = {'x':newPos.x, 'y':newPos.y}
``````

#91

nice(must be at least 20 chars)

#92

My creative moment for today.

Can you guys help me write this code more efficiently (shorter)?

``````# First points
pointOneX = 85
pointOneY = 110

pointTwoX = 60
pointTwoY = 85

pointThreeX = 60
pointThreeY = 65

pointFourX = 85
pointFourY = 40

pointFiveX = 110
pointFiveY = 65

pointSixX = 110
pointSixY = 85

# First movements
hero.toggleFlowers(False)
hero.moveXY(pointOneX, pointOneY)
hero.toggleFlowers(True)
hero.setFlowerColor("blue")
hero.moveXY(pointTwoX, pointTwoY)
hero.moveXY(pointThreeX, pointThreeY)
hero.moveXY(pointFourX, pointFourY)
hero.moveXY(pointFiveX, pointFiveY)
hero.moveXY(pointSixX, pointSixY)
hero.moveXY(pointOneX, pointOneY)

# Second points
pointOneX = 85
pointOneY = 95

pointTwoX = 70
pointTwoY = 80

pointThreeX = 70
pointThreeY = 70

pointFourX = 85
pointFourY = 55

pointFiveX = 100
pointFiveY = 70

pointSixX = 100
pointSixY = 80

# Second movements
hero.toggleFlowers(False)
hero.moveXY(pointOneX, pointOneY)
hero.toggleFlowers(True)
hero.setFlowerColor("white")
hero.moveXY(pointTwoX, pointTwoY)
hero.moveXY(pointThreeX, pointThreeY)
hero.moveXY(pointFourX, pointFourY)
hero.moveXY(pointFiveX, pointFiveY)
hero.moveXY(pointSixX, pointSixY)
hero.moveXY(pointOneX, pointOneY)

# Third points
pointOneX = 85
pointOneY = 85

pointTwoX = 78
pointTwoY = 78

pointThreeX = 78
pointThreeY = 72

pointFourX = 85
pointFourY = 65

pointFiveX = 92
pointFiveY = 72

pointSixX = 92
pointSixY = 78

# Third movements
hero.toggleFlowers(False)
hero.moveXY(pointOneX, pointOneY)
hero.toggleFlowers(True)
hero.setFlowerColor("yellow")
hero.moveXY(pointTwoX, pointTwoY)
hero.moveXY(pointThreeX, pointThreeY)
hero.moveXY(pointFourX, pointFourY)
hero.moveXY(pointFiveX, pointFiveY)
hero.moveXY(pointSixX, pointSixY)
hero.moveXY(pointOneX, pointOneY)

# Fourth points
pointOneX = 85
pointOneY = 75

pointTwoX = 110
pointTwoY = 110

pointThreeX = 110
pointThreeY = 40

pointFourX = 60
pointFourY = 110

pointFiveX = 60
pointFiveY = 40

pointSixX = 85
pointSixY = 75

# Fourth movements
hero.toggleFlowers(False)
hero.moveXY(pointOneX, pointOneY)
hero.toggleFlowers(True)
hero.setFlowerColor("red")
hero.moveXY(pointTwoX, pointTwoY)
hero.moveXY(pointThreeX, pointThreeY)
hero.moveXY(pointFourX, pointFourY)
hero.moveXY(pointFiveX, pointFiveY)
hero.moveXY(pointSixX, pointSixY)
hero.moveXY(pointOneX, pointOneY)

# Fifth points
pointOneX = 110
pointOneY = 85

pointTwoX = 110
pointTwoY = 65

pointThreeX = 60
pointThreeY = 85

pointFourX = 60
pointFourY = 65

pointFiveX = 85
pointFiveY = 75

pointSixX = 110
pointSixY = 85

# Fifth movements
hero.toggleFlowers(False)
hero.moveXY(pointOneX, pointOneY)
hero.toggleFlowers(True)
hero.setFlowerColor("purple")
hero.moveXY(pointTwoX, pointTwoY)
hero.moveXY(pointThreeX, pointThreeY)
hero.moveXY(pointFourX, pointFourY)
hero.moveXY(pointFiveX, pointFiveY)
hero.moveXY(pointSixX, pointSixY)
hero.moveXY(pointOneX, pointOneY)

``````

Thanks!

#93

Simple and effective code. Nice.

#94

#95

loop? idk I just drew scribles for that level.

#96

Ok I read this and thought hay this is what I thought also! Isn’t it great how great minds think alike?

#97

Need help with salted earth python

#98

@Tanmay_Kulkarni Which place is it in? Sarven?

#99

No, Usual Day, Backwoods forest