77,624
edits
(→Formula: Correcting the probability of a maximum yield, using LaTeX to explain mathematical steps instead of a text description. Still not hugely satisfied with this section though, as it fails to really show that other values of rand don't work.) |
|||
Line 244: | Line 244: | ||
=====Formula===== | =====Formula===== | ||
If a Berry plant is not watered at all during its growth, it will always bear its minimum number of | If a Berry plant is not watered at all during its growth, it will always bear its minimum number of Berries. Otherwise, the number of Berries produced is calculated using the following formula: | ||
<math>\ | <math>Yield = \left\lfloor \dfrac{Yield_{range} \times (water - 1) + rand}{4} \right\rfloor + Yield_{min}</math> | ||
*''max'' and ''min'' are the maximum and minimum number of Berries that can appear on the plant | *''Yield<sub>max</sub>'' and ''Yield<sub>min</sub>'' are the maximum and minimum number of Berries that can appear on the plant, respectively | ||
*'' | *''Yield<sub>range</sub>'' is difference between ''Yield<sub>max</sub>'' and ''Yield<sub>min</sub>'', i.e. it is equal to <math>(Yield_{max}-Yield_{min})</math> | ||
*''rand'' is an integer randomly chosen between 0 and <math>Yield_{range}</math>, inclusive | |||
*''water'' is the number of growth stages during which the plant was watered | *''water'' is the number of growth stages during which the plant was watered | ||
Depending on the Berry, the difference between a Berry's maximum and minimum yield can be anywhere from 1 to 4. There are a total of 4 stages a Berry can be watered in, so the maximum possible value of ''water'' is 4. | |||
===== | |||
For a fully watered plant (i.e. ''water'' equals 4), the yield will only be the maximum yield if ''rand'' equals <math>Yield_{range}</math> (its maximum value). If ''rand'' is equal to ''Yield<sub>range</sub>'', then the formula can be evaluated as follows: | |||
<math> | |||
\begin{align} | |||
Yield &= \left\lfloor \dfrac{Yield_{range} \times (4 - 1) + Yield_{range}}{4} \right\rfloor + Yield_{min} \\ | |||
&= \left\lfloor \dfrac{Yield_{range} \times 3 + Yield_{range}}{4} \right\rfloor + Yield_{min} \\ | |||
&= \left\lfloor \dfrac{Yield_{range} \times 4}{4} \right\rfloor + Yield_{min} \\ | |||
&= \left\lfloor Yield_{range} \right\rfloor + Yield_{min} \\ | |||
&= Yield_{range} + Yield_{min} \\ | |||
&= Yield_{max} | |||
\end{align} | |||
</math> | |||
If ''rand'' were to be any smaller, the numerator would be less than <math>4 \cdot Yield_{range}</math>, so the integer division would evaluate to a value less than ''Yield<sub>max</sub>''. Consequently, since ''rand'' has <math>Yield_{range} + 1</math> possible values, there is a <math>\tfrac{1}{Yield_{range} + 1}</math> chance of a fully-watered Berry plant having its maximum yield. | |||
=====Stages===== | =====Stages===== |