Refactor AFK behavior and increase ranges

This commit is contained in:
DearSky
2025-10-16 13:35:39 +08:00
committed by GitHub
parent 11c0355cef
commit 2fd032dfa5

113
5.AFK.py
View File

@@ -1,64 +1,55 @@
clear()
range_x=4
range_y=4
for i in range(range_y):
move(North)
move(East)
for i in range(range_y):
plant(Entities.Bush)
move(North)
move(East)
for i in range(range_y):
plant(Entities.Bush)
move(North)
move(East)
for i in range(range_y):
till()
plant(Entities.Carrot)
move(North)
move(East)
range_x=6
range_y=6
for i in range(2):
for i in range(range_y):
move(North)
move(East)
for i in range(2):
for i in range(range_y):
plant(Entities.Bush)
move(North)
move(East)
for i in range(2)
for i in range(range_y):
till()
plant(Entities.Carrot)
move(North)
move(East)
while True:
for i in range(range_y):
if can_harvest():
harvest()
change_hat(Hats.Purple_Hat)
move(North)
else:
do_a_flip()
change_hat(Hats.Gray_Hat)
move(North)
move(East)
for i in range(range_y):
if can_harvest():
harvest()
plant(Entities.Bush)
change_hat(Hats.Green_Hat)
move(North)
else:
do_a_flip()
change_hat(Hats.Gray_Hat)
move(North)
move(East)
for i in range(range_y):
if can_harvest():
harvest()
plant(Entities.Bush)
change_hat(Hats.Green_Hat)
move(North)
else:
do_a_flip()
change_hat(Hats.Gray_Hat)
move(North)
move(East)
for i in range(range_y):
if can_harvest():
harvest()
plant(Entities.Carrot)
change_hat(Hats.Brown_Hat)
move(North)
else:
do_a_flip()
change_hat(Hats.Gray_Hat)
move(North)
move(East)
for i in range(2):
for i in range(range_y):
if can_harvest():
harvest()
change_hat(Hats.Purple_Hat)
move(North)
else:
do_a_flip()
change_hat(Hats.Gray_Hat)
move(North)
move(East)
for i in range(2):
for i in range(range_y):
if can_harvest():
harvest()
plant(Entities.Bush)
change_hat(Hats.Green_Hat)
move(North)
else:
do_a_flip()
change_hat(Hats.Gray_Hat)
move(North)
move(East)
for i in range(2):
for i in range(range_y):
if can_harvest():
harvest()
plant(Entities.Carrot)
change_hat(Hats.Brown_Hat)
move(North)
else:
do_a_flip()
change_hat(Hats.Gray_Hat)
move(North)
move(East)