Example programs
Example programs
Plant a row (the starter program)
for i in range(3):
till()
plant(Potato)
water()
move(East)
Walk back along the row and harvest when ripe
for i in range(3):
move(West)
while not is_ripe():
wait(2)
harvest()
Full farm loop with a function (needs Functions and a 12-line motherboard)
def tend():
if is_ripe():
harvest()
if not is_tilled():
till()
plant(Potato)
water()
while True:
for i in range(3):
tend()
move(East)
move_by(-3, 0)
Ruins: loot every crate in sensor range (needs Sensors)
for c in scan_crates():
move_by(c[0] - 1, c[1])
open_crate(East)
Duskberries: pick only what's ripe, and remember the count (needs Memory)
picked = recall("picked") or 0
while True:
if is_ripe():
harvest()
picked += 1
remember("picked", picked)
wait(2)
Boss: hide while it blasts, hit it while it vents (stand next to the Warden first)
while True:
if boss_open():
attack(East)
elif danger():
move(West)
move(East)
else:
wait(0.5)
Tend an Aether Lily (needs Horticulture and Agronomy; stand on the lily with 3 different crops around it)
while not is_ripe():
if not is_watered():
water()
if get_soil() < 80:
spread(Compost)
wait(2)
harvest()
Ruins: fight anything that comes close (needs Sensors)
while True:
e = nearest_enemy()
if e == None:
wait(1)
elif e[0] > 0:
attack(East) or move(East)
elif e[0] < 0:
attack(West) or move(West)
elif e[1] > 0:
attack(South) or move(South)
else:
attack(North) or move(North)