add cactus utilities and grid-wide planting/harvesting logic
This commit is contained in:
81
main.py
81
main.py
@@ -1,7 +1,10 @@
|
||||
import cactus
|
||||
import utils
|
||||
import pumpkins
|
||||
import sunflowers
|
||||
from __builtins__ import *
|
||||
from sunflowers import harvest_grid
|
||||
|
||||
|
||||
def plant_carrots(width, height):
|
||||
utils.plant_grid(width, height, [Entities.Carrot], 0.75, True)
|
||||
@@ -12,18 +15,92 @@ def plant_grass(width, height):
|
||||
def plant_alternating(width, height, plantWith):
|
||||
utils.plant_grid(width, height, plantWith, 0.75, False)
|
||||
|
||||
# Entire grid utils:
|
||||
# These are utilities to plant & harvest the entire grid with specific plants.
|
||||
|
||||
def entire_grid_carrots():
|
||||
world_size = get_world_size()
|
||||
utils.move_to(0, 0)
|
||||
plant_carrots(world_size, world_size)
|
||||
|
||||
def entire_grid_grass():
|
||||
world_size = get_world_size()
|
||||
utils.move_to(0, 0)
|
||||
plant_grass(world_size, world_size)
|
||||
|
||||
def entire_grid_trees_and_bushes():
|
||||
world_size = get_world_size()
|
||||
utils.move_to(0, 0)
|
||||
plant_alternating(world_size, world_size, [ Entities.Tree, Entities.Bush ])
|
||||
|
||||
def entire_grid_trees_and_grass():
|
||||
world_size = get_world_size()
|
||||
utils.move_to(0, 0)
|
||||
plant_alternating(world_size, world_size, [ Entities.Tree, Entities.Grass ])
|
||||
|
||||
def entire_grid_cactus():
|
||||
world_size = get_world_size()
|
||||
utils.move_to(0, 0)
|
||||
cactus.place(world_size, world_size)
|
||||
utils.move_to(0, 0)
|
||||
cactus.sort_and_harvest(world_size, world_size)
|
||||
|
||||
def entire_grid_pumpkins():
|
||||
world_size = get_world_size()
|
||||
utils.move_to(0, 0)
|
||||
pumpkins.plant_and_verify(world_size, world_size)
|
||||
harvest()
|
||||
|
||||
def entire_grid_sunflowers():
|
||||
world_size = get_world_size()
|
||||
utils.move_to(0, 0)
|
||||
flowers = sunflowers.place(world_size, world_size)
|
||||
sunflowers.harvest_grid(flowers)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
while True:
|
||||
|
||||
while num_items(Items.Hay) < 1000000:
|
||||
entire_grid_grass()
|
||||
|
||||
while num_items(Items.Wood) < 1000000:
|
||||
entire_grid_trees_and_bushes()
|
||||
|
||||
while num_items(Items.Carrot) < 1000000:
|
||||
entire_grid_carrots()
|
||||
|
||||
while num_items(Items.Power) < 5000:
|
||||
entire_grid_sunflowers()
|
||||
|
||||
while num_items(Items.Pumpkin) < 500000:
|
||||
entire_grid_pumpkins()
|
||||
|
||||
for i in range(10):
|
||||
entire_grid_trees_and_grass()
|
||||
|
||||
entire_grid_carrots()
|
||||
entire_grid_carrots()
|
||||
entire_grid_pumpkins()
|
||||
|
||||
while True:
|
||||
worldSize = get_world_size()
|
||||
|
||||
sectionSize = worldSize // 3
|
||||
|
||||
|
||||
# only run this if our total power is below 5k.
|
||||
# why? because the rest doesn't use over 5k power.
|
||||
while num_items(Items.Power) < 5000:
|
||||
utils.move_to(0, 0)
|
||||
grid = sunflowers.place(sectionSize, sectionSize)
|
||||
utils.move_to(0, 0)
|
||||
sunflowers.harvest_grid(sectionSize, sectionSize, grid)
|
||||
|
||||
utils.move_to(0, 0)
|
||||
grid = sunflowers.place(sectionSize, sectionSize)
|
||||
cactus.place(sectionSize, sectionSize)
|
||||
utils.move_to(0, 0)
|
||||
sunflowers.harvest_grid(sectionSize, sectionSize, grid)
|
||||
cactus.sort_and_harvest(sectionSize, sectionSize)
|
||||
|
||||
utils.move_to(sectionSize+1, 0)
|
||||
plant_carrots(sectionSize, sectionSize)
|
||||
|
||||
Reference in New Issue
Block a user