Chore: checkpoint

This commit is contained in:
2025-11-10 03:07:40 +08:00
commit f13ce0450b
14 changed files with 2014 additions and 0 deletions

54
maze.py Normal file
View File

@@ -0,0 +1,54 @@
import solve, utils
import sunflower
d = [North, West, South, East]
def grow(xl, yl, n, repeat=1):
cd = 0
cnt = 0
substance = n * 2**(num_unlocked(Unlocks.Mazes) - 1)
def init():
global cnt
cnt = 0
utils.mv(xl+n/2, yl+n/2)
utils.grass()
plant(Entities.Bush)
def run():
global cd
global cnt
if cnt == 0:
init()
use_item(Items.Weird_Substance, substance)
typ = get_entity_type()
while typ != Entities.Treasure:
if typ != Entities.Hedge:
init()
use_item(Items.Weird_Substance, substance)
if can_move(d[(cd+1)%4]):
cd = (cd+1)%4
if move(d[cd]):
typ = get_entity_type()
continue
else:
cd = (cd+3)%4
cnt += 1
if cnt >= repeat:
harvest()
cnt = 0
else:
use_item(Items.Weird_Substance, substance)
return (init, run)
if __name__ == '__main__':
set_world_size(32)
utils.spawn(solve.run([
sunflower.growbase(0, 2, 0, 8),
sunflower.grow(2, 8, 0, 8),
]))
solve.run([grow(0, 0, 32)])()