Skip to content

Instantly share code, notes, and snippets.

@1337dondongo
Last active February 18, 2026 16:28
Show Gist options
  • Select an option

  • Save 1337dondongo/6cb2506bb1847d1b4490260673aa49c4 to your computer and use it in GitHub Desktop.

Select an option

Save 1337dondongo/6cb2506bb1847d1b4490260673aa49c4 to your computer and use it in GitHub Desktop.
The Farmer Was Replaced Maze with Drone and Upgraded Maze
def create_maze():
plant(Entities.Bush)
while get_entity_type()==Entities.Bush:
if num_items(Items.Weird_Substance) > get_world_size():
use_item(Items.Weird_Substance, get_world_size()*2)
return 1
if can_harvest():
harvest()
plant(Entities.Bush)
if num_items(Items.Fertilizer)==0:
# I do not have trade unlocked
#trade(Items.Fertilizer)
return 0
use_item(Items.Fertilizer)
return 1
def treasure_hunt():
dir = West
x = get_pos_x()
y = get_pos_y()
while True:
move(dir)
x2 = get_pos_x()
y2 = get_pos_y()
if x==x2 and y==y2:
if dir==West:
dir = North
elif dir==North:
dir = East
elif dir==East:
dir = South
elif dir==South:
dir = West
else:
x = get_pos_x()
y = get_pos_y()
if dir==West:
dir = South
elif dir==North:
dir = West
elif dir==East:
dir = North
elif dir==South:
dir = East
if get_entity_type()==Entities.Treasure:
harvest()
return 1
if get_entity_type()==Entities.Grass:
harvest()
return 1
def drone_hunt():
dir = East
x = get_pos_x()
y = get_pos_y()
while True:
move(dir)
x2 = get_pos_x()
y2 = get_pos_y()
if x==x2 and y==y2:
if dir==West:
dir = South
elif dir==North:
dir = West
elif dir==East:
dir = North
elif dir==South:
dir = East
else:
x = get_pos_x()
y = get_pos_y()
if dir==West:
dir = North
elif dir==North:
dir = East
elif dir==East:
dir = South
elif dir==South:
dir = West
if get_entity_type()==Entities.Treasure:
harvest()
return 1
while True:
for i in range(8):
spawn_drone(drone_hunt)
move (North)
if create_maze():
if treasure_hunt():
continue
@ShadowCoal
Copy link

for spawning drones, while(max_drones()>num_drones()) so i can send in all of my available drones
Within Drone Hunt I'm using a countdown before the clone moves randomly (seen below) so that spawned drones don't follow each other and to avoid getting drones stuck in a loop.

r=10
compass=[North,South,East,West] #above with first dir

if x==x2 and y==y2:
#same code
elif(r>0):
#same code
else:
	idx=(random()*len(compass)) //1 
	move(compass[idx])
	r=11
r-=1

note: if you're planning a reuse 300 times, I don't recommend setting r to a higher number since hedges vanish, making it more likely for drones to get stuck in loops

I'm also using: use_item(Items.Weird_Substance, (get_world_size() * 2**(num_unlocked(Unlocks.Mazes) - 1))) to spawn the maze at the same level of world size

and for the recycling farm achievement, i've adjusted both if treasure to say:

if get_entity_type()==Entities.Treasure:
	use_item(Items.Weird_Substance, (get_world_size() * 2**(num_unlocked(Unlocks.Mazes) - 1)))
	if get_entity_type()==Entities.Treasure: #assuming next treasure doesn't spawn in the same location
		harvest()
		return 1

i've successfully done a 32x32 reuse maze 300 times using these adjustments.
Note for room on improvement: change my random movement to an "move closer to chest" to improve runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment