Files
farmer-was-replaced/main.py

127 lines
3.3 KiB
Python

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)
def plant_grass(width, height):
utils.plant_grid(width, height, [Entities.Grass], 0.75, False)
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) < 50000:
utils.move_to(0, 0)
grid = sunflowers.place(worldSize, worldSize)
utils.move_to(0, 0)
sunflowers.harvest_grid(grid)
utils.move_to(0, 0)
cactus.place(sectionSize, sectionSize)
utils.move_to(0, 0)
cactus.sort_and_harvest(sectionSize, sectionSize)
utils.move_to(sectionSize+1, 0)
plant_carrots(sectionSize, sectionSize)
utils.move_to(sectionSize*2+1, 0)
plant_grass(sectionSize, sectionSize)
utils.move_to(0, sectionSize+1)
plant_alternating(sectionSize, sectionSize, [ Entities.Tree, Entities.Bush ])
utils.move_to(sectionSize+1, sectionSize+1)
pumpkins.plant_and_verify(sectionSize, sectionSize)
utils.move_to(sectionSize*2+1, sectionSize+1)
plant_carrots(sectionSize, sectionSize)
utils.move_to(0, sectionSize*2+1)
pumpkins.plant_and_verify(sectionSize, sectionSize)
utils.move_to(sectionSize+1, sectionSize*2+1)
plant_alternating(sectionSize, sectionSize, [ Entities.Tree, Entities.Bush ])
utils.move_to(sectionSize*2+1, sectionSize*2+1)
pumpkins.plant_and_verify(sectionSize, sectionSize)