The Farmer Was Replaced Pumpkin Code — Patch Dead Tiles, Then Harvest
Written for the current 1.0+ build (multi-drone era). Pumpkins merge into one giant crop. A simple harvest loop collapses the merge. Track dead tiles, replant, and harvest only when every tile is a live pumpkin.
1.0 pumpkin rules (what changed vs old tips)
- Plant on soil: `till()` until `Grounds.Soil`. Planting spends carrots (check `get_cost(Entities.Pumpkin)`).
- About 1 in 5 pumpkins die at ripeness and leave `Entities.Dead_Pumpkin`. `can_harvest()` is always False on a dead tile. Dead tiles block the giant merge.
- Fully grown adjacent pumpkins merge. Yield is **n³** for side length 1–5, then **6·n²** from 6×6 up (32×32 → 6,144). Harvest early and you only get small clusters.
- Water speeds growth (up to 5× at water level 1) but does **not** stop deaths. Planting anything on a dead pumpkin clears it (wiki). Optionally fertilize the **new** plant after replanting to cut 2s grow time.
Strategy: plant → track bad tiles → patch → harvest
Do not re-scan the whole farm forever. After the first pass, keep a list of coordinates that are empty, dead, or not yet harvestable. Only fly back to those tiles.
- Plant: Till + plant every tile once.
- Track: Append `[x, y]` when `not can_harvest()` or entity is Dead_Pumpkin.
- Patch: Replant over dead/empty; optionally `use_item(Items.Fertilizer)` on the new plant.
- Harvest: When the bad list is empty, `harvest()` once anywhere on the giant pumpkin.
🎃
Teaching script (single drone)
Uses only documented APIs. No invented helpers. After Megafarm, split the farm into column/sector loops — see the multi-drone note below.
python
def go_to(x, y):
while get_pos_x() != x:
if get_pos_x() < x:
move(East)
else:
move(West)
while get_pos_y() != y:
if get_pos_y() < y:
move(North)
else:
move(South)
def plant_full_field():
size = get_world_size()
for y in range(size):
for x in range(size):
go_to(x, y)
if get_ground_type() != Grounds.Soil:
till()
# Planting over Dead_Pumpkin removes it (wiki). No harvest needed.
plant(Entities.Pumpkin)
if get_water() < 0.75:
use_item(Items.Water)
def collect_bad_tiles():
bad = []
size = get_world_size()
for y in range(size):
for x in range(size):
go_to(x, y)
ent = get_entity_type()
if ent == Entities.Dead_Pumpkin or ent != Entities.Pumpkin or not can_harvest():
bad.append([x, y])
return bad
def patch_bad(bad):
# Only revisit problem tiles until the list is empty
while len(bad) > 0:
still_bad = []
for pos in bad:
x = pos[0]
y = pos[1]
go_to(x, y)
ent = get_entity_type()
if ent != Entities.Pumpkin:
# Dead_Pumpkin or empty: planting clears dead (wiki)
if get_ground_type() != Grounds.Soil:
till()
plant(Entities.Pumpkin)
still_bad.append([x, y])
elif not can_harvest():
# Live but still growing — wait
still_bad.append([x, y])
# else: live + harvestable — drop from list
bad = still_bad
clear()
while True:
plant_full_field()
bad = collect_bad_tiles()
patch_bad(bad)
# Full grid is live pumpkins → giant merge should be ready
go_to(0, 0)
harvest() Multi-drone (Megafarm) — Sep–Oct 2026 consensus
- Drones do **not** share globals. Give each drone its own column range or rectangle; do not append to one shared bad-tile list from every drone.
- `spawn_drone(fn)` then `wait_for(handle)` to sync phases (plant → patch → harvest). Pattern: `if not spawn_drone(task): task()`.
- Leaderboard farms water every tile and keep the bad-tile loop tight — community posts report multi-million pumpkin/min with parallel sectors.