种树效率最大化
import tool
clear()
set_execution_speed(8)
set_world_size(6)
while True:
for x in range(get_world_size()):
for y in range(get_world_size()):
tool.move_to(x, y)
tool.auto_till()
tool.auto_water()
if (x + y) % 2 == 0:
tool.auto_har()
plant(Entities.Tree)
else:
tool.auto_har()
plant(Entities.Bush)
工具箱
def auto_till():
if get_ground_type() != Grounds.Soil:
till()
def auto_water():
if get_water() < 0.75:
use_item(Items.Water)
def move_to(target_x, target_y):
# 如果当前位置在目标的左边,就一直向东(右)飞
while get_pos_x() < target_x:
move(East)
# 如果当前位置在目标的右边,就向西(左)飞
while get_pos_x() > target_x:
move(West)
# 如果当前位置在目标的下面,就向北(上)飞
while get_pos_y() < target_y:
move(North)
# 如果当前位置在目标的上面,就向南(下)飞
while get_pos_y() > target_y:
move(South)
def auto_har():
if can_harvest():
harvest()