There are two binaries.
cropbot
can play one game of crop rotation by searching all possible paths through the harvest and calculating the
expected value, in divine orbs, of each path. It is designed to be used interactively when you enter a harvest to help you pick a path.
Note that it is only computing expected values. You might still have to use your common sense sometimes.
To build from scratch:
cargo run --release --bin cropbot
I've also included a standalone .exe for windows in //releases/cropbot.exe
optimizer
calculates the probability of every initial starting condition, then uses the same functionality as cropbot
to calculate the EV of each starting condition given optimal play. It emits tables of seed quantities per starting condition.
The probability-weighted sum of these seed quantities is the expected value per map under some configuration of the atlas.
These tables can definitively answer the question of which configuration of the atlas passives have the best lifeforce yield in the long run.
Note, this is not a simulation.
https://docs.google.com/spreadsheets/d/1zIGVDc3JEJ-YD6iPIHr6RCD0SCG8S0UAZVvjYkIfGLU/edit?gid=0#gid=0
Credit to BlaydeX15 for helping me with the spreadsheet.
To build from scratch:
cargo run --bin optimizer --release
I've also included a standalone .exe at release/optimizer.exe
It takes my computer about 10 minutes to output tables for every possible configuration of the atlas.
I also added one particular run of these raw tables, which ONLY VALID FOR 3.26 or economies with similar ratios of y:b:p prices, in //atlas_tables_3.26.
Each individual seed in a plot is a Markov chain with four states, which we will label
Under crop rotation, all seeds start in the
Under the transition probabilities calculated by forgottenarbiter, this is the left-stochastic transition matrix:
(Note that in cropbot, transition probabilities are configurable in conf.toml, see t2_transition
, t3_transition
, and t4_transition
.)
At any given time, probability that a seed is in one of hte four states is represented by a 4-d vector where each component represents the probability that the seed is in the corresponding state.
For example, all seeds start in the state
which indicates the certainty of being in state
The evolution of the seed state under successive upgrades follows:
- State after 1 upgrade:
$\mathbf{s}_1 = P \mathbf{s}_0$ - State after 2 upgrades:
$\mathbf{s}_2 = P \mathbf{s}_1 = P^2 \mathbf{s}_0$ - State after
$n$ upgrades:$\mathbf{s}_n = P^n \mathbf{s}_0$
With just these remarks we can plot how many of each type of seed we expect to find in a plot that has been upgraded n times:
Each plot has 23 seeds which evolve independently, so we end up multiplying by 23 when computing plot-level expected values for seeds and divs.
Note that the top graph also has the expected lifeforce value of a plot upgrade. This doesn't account for the difference in prices between lifeforce of different colors. It also does not accurately tell you the expected value of a specific plot that you are considering upgrading, because a real plot in a real game has more information of relevance. Most importantly, a real plot has an exactly-known number of T2 seeds, and as T3 seeds are the vast majority of the profits, the number of T2 seeds (which are the only ones that convert into T3 seeds) is the most important variable in determining the expected value of an upgrade for a real plot. This graph tells you the lifeforce expectation over all possible plots.
There are up to 10 crops in a 5-plot harvest, each of which can take one of 3 colors each. Before symmetries, that would be
However, there are important symmetries to exploit:
With any plot pair, the order is irrelevant.
Furthermore, if two plot pairs of the same pair category appear on the harvest, for the purpose of calculating EV, there is no distinct choice to make between them, which turns out to be significant when optimizing cropbot.exe. In a real game, though, the two identically-colored plot pairs evolve differently and the order of harvesting does matter in a real game, but that's outside the scope of this discussion.
Anyway, there are 6 distinct pair kinds that can occur in starting conditions:
We now need to fill
-
$n = 3$ with probability$p = 0.25$ -
$n = 4$ with probability$p = 0.5$ -
$n = 5$ with probability$p = 0.25$
This is classic balls-and-bins from combinatorics, but you have to notice that the spawn points are the balls and the pair kinds are the bins. The spawn points are indistinguishable but the pair kinds are distinguishable.
For example, suppose we lay out the bins like this:
Then, let's use the stars-and-bars representation. We distribute the stars among the bins using bars to depict the bins according to the stars and bars theorem. For example:
This represents a starting condition of
(Ohh, that's a juicy one, exile!)
By the stars and bars theorem, since we only have two types of things to distribute now, we can use the binomial coefficient.
If you do this math for
For four spawn point starting conditions (
For three spawn point starting conditions (
After symmetries, there is a tractably small number of distinct starting conditions, so we can analytically solve this.
We assume that the color choice of each plot is selected independently with probabilities
We assume that the atlas passives affect the relative weighting of each plot color. For example, suppose that each plot starts with weight 100, but we allocated purple in the atlas, so that it gets 45% reduced chance to spawn, and the large blue node, so it has 25% reduced chance to spawn.
Then the relative weights are
Given this, we can compute the probability of any harvest configuration. For a harvest with
where
...this is exactly what optimizer does.