Dit is hoe wij doen in oost

This commit is contained in:
2026-10-17 03:18:43 +02:00
parent 02ab747cd0
commit d326c6b3f1
18 changed files with 126 additions and 4195 deletions
+123
View File
@@ -586,6 +586,129 @@ upgrade is owned and something was ready.
**Era:** `era_active`, `era_name`, `era_coins`, `era_harvests`.
### Continuous Delivery and crop rotation (for bots)
Continuous Delivery (Mastery upgrade `autoreplant`, 3 points, prestige 50 or higher) changes what an
empty plot means, so a bot that assumes "harvest, then plant" must account for it. This section is
the exact behavior, measured from the implementation.
**What auto-replant does, step by step.** It runs in two places and nowhere else: right after a
manual `POST /game/harvest`, and inside the CI Bot's auto-harvest during a read of your own farm.
After the harvest has been paid, the server looks at that plot again and replants it only if all of
these hold:
1. The plot is empty (the harvest cleared it and nothing else planted it in between).
2. The plot's pause flag is not set (see below).
3. The harvested crop is still unlocked for you (level, Mastery and Era checks, the same as
`POST /game/plant`).
4. You can pay the crop's current planting cost. Coins are charged atomically first, so a refused
charge leaves the plot empty and costs nothing.
If it replants, it plants **the same crop that was just harvested**. It never picks a better crop
and it does **not** look at Market Saturation: a saturated crop is replanted exactly like any other.
The new planting starts at the moment of the harvest, uses your current CI tier, perks and Legacy
speed for its build time, and gets its own fresh golden-build roll.
Side effects that differ from a manual `POST /game/plant`:
| | Manual plant | Auto-replant |
|---|---|---|
| Charges the planting cost | yes | yes |
| Advances the daily "plant" quest | **yes** | **no** |
| Writes a `game.plant` audit event | yes | no |
| Reported in the harvest response | n/a | **no**, read the plot from the returned `farm` |
The harvest itself (coins, XP, the "harvest" and "earn" quests, the weekly harvest count) is
identical either way. If you farm the daily "plant" quest, plant at least once by hand.
**The one-shot pause: `POST /game/plot/stop`.** Before this existed, the only way to change what a
plot grows was a Refactor. Now you can pause the replant for one plot, one harvest at a time:
| Field | Type | Meaning |
|---|---|---|
| `slot` | integer, 0-64 | Plot to change. |
| `stop` | boolean | `true` skips the replant after the next harvest of this plot. `false` cancels a pending pause. |
Returns the usual `{"ok": true, "farm": {...}}`. Rules, all enforced server side:
- It needs Continuous Delivery. Without it: **400** `Continuous Delivery is not unlocked.`
- The plot must currently hold a crop (growing or ready). On an empty plot: **400**
`That plot is empty.` This is also the answer when the harvest wins a race against your call (see
below), so treat it as "go read the state", not as a failure.
- It is **one-shot and per plot**. It applies to the next harvest of that plot only, and each plot
needs its own call. Setting it again on a plot that already has it, or clearing it on a plot
that does not, succeeds and changes nothing.
- It is cleared automatically the next time anything puts a crop on that plot: your manual
`POST /game/plant`, an auto-replant, or a Refactor. You never have to clear it by hand.
- It costs nothing and is not refundable or limited, but it is a mutating call, so it counts
against the rate limit like any other POST.
**What you can read.** Each plot in your own farm carries two booleans, always present:
- `can_stop_replant` - true on a plot that holds a crop when you own Continuous Delivery. False on
an empty plot, without the upgrade, and on every plot of someone else's farm.
- `stop_after_harvest` - true while the pause is set on a plot that still holds a crop. It is
never true on an empty plot, on a plot of another farm, or without the upgrade, so a stale flag
can never be observed.
**Rotation recipe.** To change the crop on a plot:
1. Call `POST /game/plot/stop` with `stop=true` while the plot is growing. Do it well before
`ready_at`, because with the CI Bot the harvest can happen during any read of your farm once the
build is ready.
2. Wait until `ready_at` has passed, then harvest (or let the CI Bot do it on your next read).
3. The plot is now empty. Plant what you want with `POST /game/plant`. The pause is cleared by that
plant.
Between the harvest and your plant the plot sits idle, so every rotation costs you the time it
takes your bot to notice. Without the CI Bot that is up to one poll interval. A bot that polls
every 60 seconds loses about half a minute per rotation on average, which is why rotating only pays
off when the new crop beats the old one by more than that idle time.
**Race behavior (verified with concurrent processes).** A pause call and a harvest of the same plot
at the same instant always resolve one of two ways, never a third: either the pause lands first
(HTTP 200, the plot ends empty) or the harvest lands first (the plot is already replanted, and your
call gets the 400 `That plot is empty.`). We ran 150 rounds with the two calls in separate
processes: 87 pause-first, 63 harvest-first, 0 inconsistent. After a 400 on this endpoint, re-read
`GET /game/state` and look at the plot instead of retrying blindly.
**Do you need to rotate to avoid Market Saturation?** Usually not, and the numbers say so. A
saturated crop pays at worst 40 percent of its normal value. At prestige 50 the prestige multiplier
is 13.5, so even with no perks, no golden build and the 40 percent floor, every crop pays at least
about 11 times its planting cost (shell about +54 coins on a 5 coin plant, kernel about +18,240 on
1,200). Skipping a replant to dodge saturation therefore usually earns less than replanting into
it, because an idle plot earns nothing and also forgoes the XP, quest progress and weekly harvest
count of the cycle. Rotate when a **different crop pays more per second**, not merely to avoid the
`saturated` label. These figures are computed from the published formulas, not measured on a live
farm, and they change if the saturation tiers or prestige multiplier are rebalanced.
**Edge cases a bot should handle.**
- An auto-replant can be refused (cost, lock). The plot then just stays empty, so a loop that
plants every `state == "empty"` plot, like the script below, already covers it.
- An Era crop stops being plantable when its Era ends. Auto-replant now respects that and leaves the
plot empty instead of replanting a locked crop.
- The upgrade itself is permanent: Mastery points are never refunded and there is no switch that
turns Continuous Delivery off for the whole farm. The per-plot pause is the only control.
- A Refactor clears every plot, does **not** auto-replant, and clears all pauses. Plant again after
it.
A rotation helper that moves every plot to one target crop, using only the standard library:
```python
def rotate_to(call, wanted):
farm = call("GET", "/game/state")["farm"]
for plot in farm["plots"]:
if plot["state"] == "empty":
call("POST", "/game/plant", {"slot": plot["slot"], "crop": wanted})
elif plot["crop_key"] != wanted and plot["can_stop_replant"] and not plot["stop_after_harvest"]:
call("POST", "/game/plot/stop", {"slot": plot["slot"], "stop": "true"})
```
Call it on every poll. A plot growing the wrong crop gets paused once, its harvest leaves it empty,
and the next poll plants `wanted` there. Plots already growing `wanted` are left alone, and the
auto-replant keeps them running.
### A complete automated farmer
This script plays the core loop on a schedule: it claims the daily bonus and any finished quests,