The Farmer Was Replaced Maze Code — Left-Wall Follower
Paste the script below. A fresh maze has no loops: keep your left hand on the wall and you will hit the treasure. Harvest only the chest.
Copy-paste: spawn a maze, then walk the left wall
python
def spawn_maze():
if get_ground_type() != Grounds.Soil:
till()
harvest()
plant(Entities.Bush)
size = get_world_size()
use_item(Items.Weird_Substance, size)
def solve_maze():
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_maze() Why wall-follower scripts spin in circles
- Stand on a bush and call `use_item(Items.Weird_Substance, n)` to grow an n×n hedge maze. Fertilizer on plants is how you get Weird Substance.
- `harvest()` on the treasure gives gold equal to the maze area (5×5 → 25). Harvest anything else and the whole maze vanishes.
- `get_entity_type()` is `Entities.Treasure` on the chest and `Entities.Hedge` on walls you cannot fly over.
- `move()` returns False when a wall blocks you. `can_move(direction)` checks without moving. `measure()` anywhere in the maze returns the treasure coordinates.
After the first maze
Reusing Weird Substance on the treasure moves the chest and can punch holes in walls. Those mazes have loops, so a plain wall follower can circle forever. For leaderboard runs, use `measure()` to walk toward the chest instead of hugging walls.