The Farmer Was Replaced Maze Code — Fresh Walls, Then Gold
Rewritten for 1.0+. Fresh mazes have no loops — left-wall works. Reused mazes get loops; prefer `measure()` or many small mazes per drone.
Maze rules in 1.0+
- Fertilize plants to earn `Items.Weird_Substance` (infected harvest pays half as substance). Need a stockpile first? farm Weird Substance first
- On a bush: `use_item(Items.Weird_Substance, n)` grows an n×n hedge maze (without upgrades). With maze upgrades, substance needed roughly doubles per level — use `get_world_size() * 2**(num_unlocked(Unlocks.Mazes) - 1)` for a full-field maze.
- `harvest()` on `Entities.Treasure` → gold = area × maze upgrade. Harvest anything else → maze vanishes.
- `measure()` **anywhere** in the maze returns treasure coordinates (1.0 change). `can_move(dir)` / failed `move()` = 1 tick wall probe.
- Reuse: Weird Substance on the treasure relocates it (up to 300×) and can punch wall holes → **loops**. Plain wall-follower is outdated there. Reuse does **not** pay more gold than spawn+harvest anew.
Beginner: spawn fresh maze + left-wall
python
def spawn_maze():
if get_ground_type() != Grounds.Soil:
till()
harvest()
plant(Entities.Bush)
# Beginner (no / low maze upgrades): n = world size.
# With upgrades, wiki: world_size * 2**(num_unlocked(Unlocks.Mazes) - 1)
n = get_world_size()
use_item(Items.Weird_Substance, n)
def solve_left_wall():
dirs = [North, East, South, West]
facing = 0
while get_entity_type() != Entities.Treasure:
left = (facing - 1) % 4
if can_move(dirs[left]):
facing = left
move(dirs[facing])
elif can_move(dirs[facing]):
move(dirs[facing])
else:
facing = (facing + 1) % 4
harvest()
clear()
while True:
spawn_maze()
solve_left_wall() Better for reused / looped mazes: walk toward measure()
Ask for treasure coords first, then path with wall checks. Still not optimal for leaderboard, but it stops infinite left-wall circles.
python
def go_toward(tx, ty):
# Greedy step with can_move — enough for teaching
while get_pos_x() != tx or get_pos_y() != ty:
if get_pos_x() < tx and can_move(East):
move(East)
elif get_pos_x() > tx and can_move(West):
move(West)
elif get_pos_y() < ty and can_move(North):
move(North)
elif get_pos_y() > ty and can_move(South):
move(South)
else:
# Blocked — spin with left-wall for a bit
return False
return True
tx, ty = measure()
go_toward(tx, ty)
if get_entity_type() == Entities.Treasure:
harvest() Multi-drone gold (Reddit Sep 2026)
- Usually faster: pack the 32×32 farm with **many small mazes** (e.g. 32× 5×5) — one drone each — than one huge maze with 32 drones.
- Branching drones at junctions (spawn on every exit, die on dead ends) looks great but cannot parallelize as many mazes — use for fun, not max gold/s.
- Leaderboard Maze target ≈ 301 treasures × fully upgraded 32×32 gold — reuse 300 times **or** spawn fresh; community cheese prefers many short mazes.