import utils import solve def mv(tx, ty): utils.mv(tx, ty, True) def grow(xl, xr, yl, yr): def init(): for x in range(xl, xr): l, r, d = yl, yr, 1 if x%2 == 1: l, r, d = yr-1, yl-1, -1 for y in range(l, r, d): utils.mv(x, y) typ = x%2 + y%2 if typ == 0: utils.grass() if typ == 1: utils.grass() if typ == 2: utils.soil() def run(): for x in range(xl, xr): l, r, d = yl, yr, 1 if x%2 == 1: l, r, d = yr-1, yl-1, -1 for y in range(l, r, d): utils.mv(x, y) utils.water() utils.harv() typ = x%2 + y%2 if typ == 0: pass # weed if typ == 1: if get_entity_type() == Entities.Grass: plant(Entities.Tree) if typ == 2: utils.replant(Entities.Carrot) return (init, run) def grow_row(x, yl, yr): def ret(): for y in range(yl, yr): mv(x, y) typ = x%2 + y%2 if typ == 0: utils.grass() utils.replant(Entities.Tree) if typ == 1: utils.soil() utils.replant(Entities.Carrot) if typ == 2: utils.grass() while True: for y in range(yl, yr): mv(x, y) typ = x%2 + y%2 if typ == 1: utils.water() while not utils.harv(): pass utils.replant(Entities.Carrot) return ret if __name__ == '__main__': set_world_size(32) clear() for x in range(0, 32-1): spawn_drone(grow_row(x, 0, 32)) grow_row(32-1, 0, 32)()