Mastering Mega Pumpkins: Coordinate Tracking
Pumpkins are special because they fuse into larger crops. A simple harvest loop won't work. We need a smart script that waits for the fusion to complete.
The Strategy: Patch & Wait
The goal is to get a full grid of pumpkins to form a Giant Pumpkin. If one spot dies or is empty, the fusion fails.
- Track: Record coordinates of all empty or unripe spots.
- Patch: Drone visits only these specific spots to replant.
- Harvest: Harvest only when the problem list is empty (grid is full).
🎃
Step-by-Step Code Analysis
Step 1 Smart Movement Logic
To prevent the drone from getting stuck on giant pumpkins, we need a robust `moveEx` function. If blocked, it tries other directions.
def moveEx(dir):
dirs=[East,South,West,North]
dirs.remove(dir)
# Try intended direction first
if(not move(dir)):
# If blocked, try alternatives to wiggle out
if(not move(dirs[0])):
if(not move(dirs[1])):
if(not move(dirs[2])):
return False Step 2 Tracking & Replanting
The `doPumpkin` function maintains a `success` list. It repeatedly checks spots in this list until everything is ready.
def doPumpkin():
back()
success = [] # List of "problematic" coordinates
# Helper to track empty spots
def adddie():
if not can_harvest():
success.append({"x":get_pos_x(),"y":get_pos_y()})
plantpumpkin()
# Helper to check if spot is fixed
def removedie():
if(can_harvest()):
success.remove({"x":get_pos_x(),"y":get_pos_y()})
else:
plantpumpkin()
# Initial Pass: Scan whole grid
plantonce(adddie)
# Re-visit Loop: Only go to bad spots
while(len(success) != 0):
for pos in success:
back(pos["x"],pos["y"])
removedie()
return len(success)==0 Complete Source Code
PythonNote: This script includes logic for multiple crops, but the main entry point is pumpProject() at the bottom.
def back(x=0,y=0):
while x!=get_pos_x() or y!=get_pos_y():
while get_pos_x()!=x:
if(get_pos_x()<x):
moveEx(East)
else:
moveEx(West)
while get_pos_y()!=y:
if(get_pos_y()<y):
moveEx(North)
else:
moveEx(South)
def moveEx(dir):
dirs=[East,South,West,North]
dirs.remove(dir)
if(not move(dir)):
if(not move(dirs[0])):
if(not move(dirs[1])):
if(not move(dirs[2])):
return False
def do(x,worldsize=0):
if worldsize == 0:
worldsize=get_world_size()
dir=East
for i in range(worldsize):
for j in range(worldsize-1):
x()
move(dir)
x()
move(North)
if(dir==East):
dir=West
else:
dir=East
# --- Pumpkin Logic Start ---
def plantpumpkin():
plant(Entities.Pumpkin)
def doPumpkin():
back()
success = []
def adddie():
if not can_harvest():
success.append({"x":get_pos_x(),"y":get_pos_y()})
plantpumpkin()
def removedie():
if(can_harvest()):
success.remove({"x":get_pos_x(),"y":get_pos_y()})
else:
plantpumpkin()
def plantonce(x):
dir = East
for i in range(get_world_size()):
for j in range(get_world_size()-1):
x()
move(dir)
x()
move(North)
if dir == East:
dir=West
else:
dir=East
plantonce(plantpumpkin) # First planting
back()
plantonce(adddie) # Check for failures
# Keep fixing specific spots
while(len(success) != 0):
for pos in success:
back(pos["x"],pos["y"])
removedie()
return len(success)==0
def pumpProject():
# Helper to till ground first
def tillx():
if(get_ground_type()==Grounds.Grassland):
till()
back()
do(tillx)
while True:
# Wait until doPumpkin returns true (all spots ready)
while doPumpkin():
back()
harvest()
# --- Pumpkin Logic End ---
# Start the bot
clear()
pumpProject() Pumpkin Farming Tips
- • Ensure your land is tilled. The script includes `tillx` to handle grassland automatically.
- • Use water if possible. Pumpkins grow faster and fuse more reliably on watered soil.