import utils from __builtins__ import Entities def plant_pumpkin(width, height): x = get_pos_x() y = get_pos_y() utils.plant_grid(width, height, [Entities.Pumpkin], 0.75, True) utils.move_to(x, y) while verify_pumpkin(sectionSize, sectionSize): utils.move_to(x, y) 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) # verify_pumpkin will verify that a pumpkin is planted in all tiles of a quadrant, and it will check that # the pumpkin isn't dead. if it's dead it will replant it. Returns whether any dead pumpkins were found. def verify_pumpkin(width, height): result = False others = {East:West, West:East} sideDir = East for row in range(height): for col in range(width): if get_entity_type() == Entities.Dead_Pumpkin: # ~20% of pumpkins die, we just replant plant(Entities.Pumpkin) result = True # if it's not the last pass, then move if col < width - 1: move(sideDir) if row < height - 1: sideDir = others[sideDir] move(North) return result #reset_pos() while True: worldSize = get_world_size() sectionSize = worldSize // 3 utils.move_to(0, 0) plant_pumpkin(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) plant_pumpkin(sectionSize, sectionSize) utils.move_to(sectionSize*2+1, sectionSize+1) plant_carrots(sectionSize, sectionSize) utils.move_to(0, sectionSize*2+1) plant_alternating(sectionSize, sectionSize, [ Entities.Tree, Entities.Bush ]) 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) plant_pumpkin(sectionSize, sectionSize)