编程农场南瓜代码 — 先补枯死格,再收巨大南瓜
按当前 1.0+(多无人机)机制重写。南瓜会合并成巨大作物;普通收割循环会拆掉合并。记下枯死格、补种,整田都是活南瓜再收。
1.0 南瓜规则(和旧攻略差在哪)
- 种在土上:`till()` 到 `Grounds.Soil`。种植消耗胡萝卜(用 `get_cost(Entities.Pumpkin)` 看花费)。
- 约五分之一成熟时枯死,留下 `Entities.Dead_Pumpkin`。枯死格上 `can_harvest()` 永远是 False,并挡住巨大合并。
- 相邻成熟南瓜会合并。边长 1–5 产量是 **n³**,从 6×6 起是 **6·n²**(32×32 → 6144)。提前收只剩小块。
- 浇水加速生长(水位 1 时最高约 5×),但**挡不住**枯死。在枯死格上种任何东西都会清掉它(wiki)。补种后可对**新苗**施肥,缩短约 2 秒生长。
策略:种满 → 记坏格 → 只补坏格 → 再收
不要永远全图扫描。第一遍之后,只保留空格、枯死、未成熟的坐标列表,无人机只飞回这些格子。
- 种: 每格翻土并种一次。
- 记: `not can_harvest()` 或实体是 Dead_Pumpkin 时记下 `[x, y]`。
- 补: 在枯死/空格上补种;可对新苗 `use_item(Items.Fertilizer)`。
- 收: 坏格列表空了,在巨大南瓜任意一格 `harvest()` 一次即可。
🎃
教学脚本(单无人机)
只用文档里的 API。解锁 Megafarm 后按列/扇区拆分——见下方多无人机说明。
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() 多无人机(Megafarm)— 2026年9–10月共识
- 无人机**不共享**全局变量。每架机分一段列或矩形;不要让所有机往同一个坏格列表里 append。
- `spawn_drone(fn)` 后用 `wait_for(handle)` 同步阶段(种→补→收)。常用:`if not spawn_drone(task): task()`。
- 冲榜会每格浇水并收紧坏格循环——社区有多扇区并行冲到数百万南瓜/分钟的记录。