-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquareSunflowerPlant.py
More file actions
36 lines (33 loc) · 1.21 KB
/
Copy pathSquareSunflowerPlant.py
File metadata and controls
36 lines (33 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def SquareSunflowerPlanter():
numPlots = get_world_size() * get_world_size()
largestPetalCount = []
seed = Items.Sunflower_Seed
sunflowers = []
if not BuyEnoughSeeds(seed):
return
# Plant and water sunflowers
for xPos in range(get_world_size()):
for yPos in range(get_world_size()):
if get_ground_type() != Grounds.Soil:
till()
CheckWater()
plant(Entities.Sunflower)
sunflowers.append([measure(), xPos, yPos])
move(North)
move(East)
# Harvest sunflowers in order of largest to smallest
while len(sunflowers) > 0:
largestPetalCount = 0
largestSunflowers = []
for i in range(len(sunflowers)):
if sunflowers[i][0] == largestPetalCount:
largestSunflowers.append(sunflowers[i])
if sunflowers[i][0] > largestPetalCount:
largestPetalCount = sunflowers[i][0]
largestSunflowers = [sunflowers[i]]
for sunflower in largestSunflowers:
OldFlyTo(sunflower[1], sunflower[2])
harvest()
sunflowers.remove(sunflower)
# All done, return to origin
FlyTo(0, 0)