40 lines
760 B
Python
40 lines
760 B
Python
import utils
|
|
|
|
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)
|
|
|
|
if __name__ == '__main__':
|
|
pass
|