Tendril

Reference

Every command, question and helper in Sprout, with what it costs and an example.

Actions

Actions change the farm. Each one ends the bot's turn and keeps it busy for the ticks shown.

move direction2 ticks

Move one tile on owned land; returns true on success.

move east

till3 ticks

Prepare an empty tile for planting. The barn and buildings cannot be tilled.

till

plant crop2 ticks

Plant a researched crop on empty, tilled soil.

plant carrot

water2 ticks

Add 30 moisture, up to 100.

water

harvest3 ticks

Harvest produce or ready hive honey; returns the units carried.

harvest

deposit1 tick

Move carried produce into barn stock. Compost stays carried.

deposit

wait ticksn ticks

Wait at least one tick. Long waits split into 1,000-tick actions.

wait 100

sell item, units1 tick

Sell barn stock at today’s price (the base price outside market days); use all for the whole stock of an item.

sell carrot, all

deliver order2 ticks

At the barn, fulfil a contract using stock; returns its coin reward.

deliver orders()[0]

build kind4 ticks

Build a researched hive or composter on empty grass, paying its coin price.

build hive

clear3 ticks

Remove a crop, tilled soil or building. No refund or produce is returned.

clear

compost2 ticks

At a composter, convert four carried crop units into one compost.

compost

fertilize2 ticks

Use one carried compost: add 25 nitrogen and remove 20 fatigue.

fertilize

Farm actions

Farm actions spend coins. They happen instantly, cost no ticks and don't end the bot's turn.

buy_plot px, py

Buy an edge-adjacent 8×8 plot; returns true on success.

buy_plot 1, 0

buy_bot

Buy a new bot at the barn. Returns its zero-based id, or none.

buy_bot

unlock name

Pay the research price for a crop, building or satchel.

unlock wheat

Questions

Questions look at the farm without changing it. They are free.

scan()

Inspect the tile below this bot; includes ripe, empty, crop, soil and building.

FieldMeaning
x, yWhere the tile is.
tilledtrue if the soil is tilled.
cropThe crop name, or none.
stage0 to 3. The crop is ripe at 3.
ripetrue when there is a ripe crop.
emptytrue when there is no crop, no building, and it isn't the barn: ready to till and plant.
moisture, nitrogen, fatigueSoil numbers from 0 to 100.
barntrue on the barn.
buildinghive, composter or none.
honeyJars of honey waiting in a hive.
say scan()

scan_at(x, y)

Inspect an owned tile, or return none for unowned land.

say scan_at(1, 1)

position()

Return this bot’s {x, y} position.

say position()

my_id()

This bot’s zero-based id.

say my_id()

load()

Return carried units by item name.

say load()

carried()

Total carried units.

say carried()

capacity()

The carrying capacity: 20, or 30 with a satchel.

say capacity()

tick()

Current farm tick.

say tick()

owns(x, y)

Whether the tile belongs to your farm.

say owns(1, 1)

plots()

Owned plots in purchase order.

say plots()

tiles()

Owned tile positions, in plot order then row order.

say tiles()

forecast(ticks)

Rain and frost segments overlapping the next ticks.

say forecast(500)

weather()

clear, rain or frost.

say weather()

orders()

Open contracts with crop, quantity, reward and deadline.

say orders()

stock()

Barn units by item name.

say stock()

coins()

Current coin balance.

say coins()

plot_cost()

Price of the next plot.

say plot_cost()

bot_cost()

Price of the next bot.

say bot_cost()

bots()

Number of bots on your farm.

say bots()

unlocked(name)

Whether the named research is unlocked.

say unlocked(carrot)

unlock_cost(name)

Price of named research.

say unlock_cost(carrot)

price(item)

Selling price of an item. On a market day it is today’s price in hundredths of a coin (200 means 2 coins); otherwise the base price in whole coins.

say price(carrot)

Utilities

Helpers for lists, text and numbers, plus printing and walking. All free except go_to, which moves.

go_to position / x, y2 per tile ticks

Walk east/west first, then north/south. Every move takes two ticks.

go_to barn

say values…

Print values to the console, tagged with this bot and tick.

say "Hello from bot", my_id()

print values…

Print values, like say.

print "hello"

len(value)

Length of a list, record or string.

say len(tiles())

abs(n)

Absolute value.

say abs(-3)

min(values…)

Smallest value; accepts a list.

say min(2, 5)

max(values…)

Largest value; accepts a list.

say max(2, 5)

range(end / start, end)

A list of integers, excluding end.

for each n in range(4):
    say n

append list, value

Add a value to the list’s end.

xs = []
append xs, 1

pop(list)

Remove and return the last item.

xs = [1, 2]
say pop(xs)

insert list, index, value

Insert a value at an index.

xs = [1]
insert xs, 0, 2

remove list, index

Remove the item at an index.

xs = [1, 2]
remove xs, 0

contains(collection, value)

Test membership.

say contains([1, 2], 2)

keys(record)

Return record keys.

say keys({x: 1})

sorted(list)

Return a sorted copy of integers or strings.

say sorted([3, 1])

reversed(list)

Return a reversed copy.

say reversed([1, 2])

str(value)

Convert a value to readable text.

say str(42)

int(value)

Convert a decimal string to an integer, or none.

say int("42")

random(upper)

Seeded random integer from zero to upper minus one.

say random(4)

distance(a, b)

Manhattan distance between tile positions.

say distance(position(), barn)

Names

Built-in names you can use anywhere.

northThe name north.
eastThe name east.
southThe name south.
westThe name west.
carrotThe name carrot.
wheatThe name wheat.
cloverThe name clover.
pumpkinThe name pumpkin.
berryThe name berry.
appleThe name apple.
honeyThe name honey.
hiveThe name hive.
composterThe name composter.
satchelThe name satchel.
barnThe position {x: 0, y: 0}.
allThe name all.
sharedOne record visible to every bot. Not stored in the farm checkpoint.

Keywords

These words are part of the language and can't be used as names. See Learn Sprout for how they're used.

ifelifelsewhilerepeatforevertimesforeachinfromtostepdefinedefreturnbreakcontinuepassstopandornotistruefalsenonesetglobal