The Farmer Was Replaced Carrot Code — Till, Buy Seeds, Plant

Carrots are the first crop that costs resources. Grass is free. Carrots need tilled soil and seeds you buy with hay. Paste the script, then read why `till()` matters.

Copy-paste carrot loop

python
while True:
    if can_harvest():
        harvest()

    if get_ground_type() != Grounds.Soil:
        till()

    if num_items(Items.Carrot_Seed) < 1:
        trade(Items.Carrot_Seed)

    if get_water() < 0.75:
        if num_items(Items.Water_Tank) < 1:
            trade(Items.Empty_Tank)
        if num_items(Items.Water_Tank) > 0:
            use_item(Items.Water_Tank)

    plant(Entities.Carrot)
    move(East)
    if get_pos_x() == get_world_size() - 1:
        move(North)

Carrot rules that break most scripts

  • `plant(Entities.Carrot)` fails on grass. Call `till()` until `get_ground_type() == Grounds.Soil`. Older notes said Turf; the current ground string is Grassland or Soil.
  • Seeds are `Items.Carrot_Seed`. Buy them with `trade(Items.Carrot_Seed)` when hay is high enough. If trade does nothing, farm grass first.
  • `get_water()` is 0 to 1. Watering can speed growth several times. Skip the water block if you have not unlocked tanks yet.
  • Companion planting (`get_companion()`) comes later. This page is the beginner loop. Do not mix trees next to every carrot until you unlock polyculture.

After this script works

Pumpkins also need soil and seeds, but they merge and about 1 in 5 die. Trees need a checkerboard so they are not adjacent. Use those pages next — do not keep expanding this loop into a mega-script.

pumpkin code · tree code