The Farmer Was Replaced Tree Code — Checkerboard Wood Farm
Trees drop 5 wood — better than bushes — but they hate sharing an edge. Each adjacent tree doubles grow time. Four neighbors is 16× slower. The in-game hint is `% 2`.
Tree rules (this is why adjacency hurts)
- A grown tree yields 5 wood. Bushes give less, so trees are the wood crop once you unlock them.
- You can plant on grass or soil. `till()` is optional for trees.
- Only North, East, South, and West count. Each of those neighboring trees **doubles** grow time. 1 neighbor = 2×, 2 = 4×, 3 = 8×, 4 = 16×.
- Diagonals do not count. A checkerboard has trees touching only on corners.
Why a checkerboard, not a solid tree field
If you fill every tile with trees, the middle of the farm is surrounded on four sides and grows 16× slower. Wood per second collapses even though every tile is a tree.
Plant trees where `(x + y) % 2 == 0` (or the odd color — both work). Put bushes on the other color so those tiles still produce. The in-game hint uses `% 2`.
- Read: `get_pos_x()` and `get_pos_y()`.
- Split: Even sum → `plant(Entities.Tree)`. Odd sum → `plant(Entities.Bush)`.
- Cycle: `can_harvest()` then `harvest()`, plant, `move`.
Even tiles = trees, odd tiles = bushes
Copy-paste tree + bush script
Step 1 The `% 2` test
Same color as the in-game hint. Swap `== 0` and `== 1` if you want trees on the other squares.
x = get_pos_x()
y = get_pos_y()
if (x + y) % 2 == 0:
plant(Entities.Tree)
else:
plant(Entities.Bush) Step 2 Scan, harvest, plant, move
Harvest if ready, then plant the right crop for this color, then walk the grid. Repeat forever.
Complete source code
Pythondef 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)
clear()
while True:
size = get_world_size()
for y in range(size):
for x in range(size):
go_to(x, y)
if can_harvest():
harvest()
if (x + y) % 2 == 0:
plant(Entities.Tree)
else:
plant(Entities.Bush) Optional watering
Water speeds growth. It does not cancel the adjacency penalty — a tree with four neighbors is still 16× slower, just 16× slower on wet soil. Add this after `plant(...)`.
if get_water() < 0.75:
use_item(Items.Water_Tank) Next: pumpkins, then polyculture
When wood is stable, unlock pumpkins. About 1 in 5 die; harvest the giant crop only when the whole grid is ready. Pumpkin code
Polyculture comes later. `get_companion()` tells you which crop the current plant wants as a neighbor. That is a different layout than this checkerboard — do not mix the two ideas.