There are many things in the game that follow this mechanism to choose different effect/type randomly such as Golden cookie, Wrath cookie, Force the Hand of Fate and Sugar Lump. Basically the mechanism starts with a pool which contains certain effects. Then it adds different effects to the pool randomly. Finally it chooses one effect from the pool with equal probability.
Sugar LumpEdit
Take the type of Sugar Lump as an example. The type determination procedure is as follows.
- Add Normal to a pool.
- If you have upgrades Sucralosia Inutilis, 15% chance to add Bifurcated to the pool, otherwise 10% chance to add Bifurcated to the pool.
- 0.3% chance to add Golden to the pool.
- 0%, 10%, 20% and 30% to add Meaty to the pool if the game is in Appeased, Awoken, Displeased and Angered phase of Grandmapocalypse respectively.
- Pick a random effect from the pool.
Through the whole process, the dice is thrown once to determine a random number P satisfying 0<P<1.
Type | Probability |
---|---|
Normal | P_{N}=1 |
Bifurcated | P_{B}=0.1 or 0.15 |
Golden | P_{G}=0.003 |
Meaty | P_{M}=0.1×grandmas' anger level =0, 0.1, 0.2, 0.3 |
If P<P_{i}, then the i type will be added to the pool.
When P_{h}>=P_{i}>=P_{j}>=P_{k}, probability of selecting a h type: (P_{h}-P_{i})+(P_{i}-P_{j})/2+(P_{j}-P_{k})/3+P_{k}/4, i type: (P_{i}-P_{j})/2+(P_{j}-P_{k})/3+P_{k}/4, j type: (P_{j}-P_{k})/3+P_{k}/4 and k type: P_{k}/4.
Then we can calculated all the results.
Phase of
Grandmapocalypse | Probability without Sucralosia Inutilis | Average number
of lumps | |||
---|---|---|---|---|---|
Normal | Bifurcated | Golden | Meaty | ||
Appeased | 0.9495 | 0.0495 | 0.001 | 0 | 1.02825 |
Awoken | 0.933083 | 0.033083 | 0.00075 | 0.033083 | 1.01916 |
Displeased | 0.883083 | 0.033083 | 0.00075 | 0.083083 | 1.01916 |
Angered | 0.833083 | 0.033083 | 0.00075 | 0.133083 | 1.01916 |
Phase of
Grandmapocalypse | Probability with Sucralosia Inutilis | Average number
of lumps | |||
---|---|---|---|---|---|
Normal | Bifurcated | Golden | Meaty | ||
Appeased | 0.9245 | 0.0745 | 0.001 | 0 | 1.0426125 |
Awoken | 0.908083 | 0.058083 | 0.00075 | 0.033083 | 1.03311875 |
Displeased | 0.87475 | 0.04975 | 0.00075 | 0.07475 | 1.02874375 |
Angered | 0.82475 | 0.04975 | 0.00075 | 0.12475 | 1.02874375 |
Force the Hand of FateEdit
The procedure of Force the Hand of Fate is a little different. For golden cookie, the procedure is:
Win:
- Add Frenzy and Lucky to a pool.
- If there is no Dragonflight buff active, add Click Frenzy.
- 10% chance to add Storm, Storm and Blab to the pool.
- 25% chance to add Building Special, if the you owned more than or equal to 10 total building.
- For all building of which number more or equal to 10, choose one and buff according to the chosen building's amount. If no building has such quantity, choose Frenzy.
- 15% chance to replace the pool with Storm Drop.
- 0.01% chance to add Free Sugar Lump to the pool.
- Pick a random effect from the list.
Note the there is 15% chance that the pool is replaced completely instead of adding something into the pool. To handle this rule properly, consider two cases. First assume that the pool is never replaced.
Probability without Dragonflight (Win) | ||||
---|---|---|---|---|
Frenzy=Lucky=C. Frenzy | Storm | Blab | Building | Sugar |
0.2973144554 | 0.03214241071 | 0.01607120536 | 0.05982025893 | 0.00002275892857 |
Second, assume that the pool is always replaced:
Probability without Dragonflight (Win) | |
---|---|
StormDrop | Sugar |
0.99995 | 0.00005 |
The actual probability will be mix of these two cases.
Probability without Dragonflight (Win) | |||||
---|---|---|---|---|---|
Frenzy=Lucky=C. Frenzy | Storm | Blab | Building | StormDrop | Sugar |
0.2527172871 | 0.02732104911 | 0.01366052455 | 0.05084722009 | 0.1499925 | 0.00002684508929 |
Fail:
- Add Clot and Ruin to a pool.
- 10% chance to add Cursed Finger, Elder Frenzy to the pool.
- 0.3% chance to add Free Sugar Lump to the pool.
- 10% chance to replace the pool with Blab.
- Pick a random effect from the list.
Probability (Fail) | |||
---|---|---|---|
Clot=Ruin | Cursed Finger=Elder Frenzy | Sugar | Blab |
0.4270815 | 0.0224865 | 0.000864 | 0.1 |
Golden/Wrath cookieEdit
For Golden cookie and Wrath cookie, there is an additional rule. Take the procedure of picking effect of golden cookie in version 1.0466 as an example:
- Add Frenzy and Lucky to a pool.
- 3% chance to add Chain to the pool, if at least 100,000 cookies have been baked in this game.
- 10% chance to add Click Frenzy to the pool.
- 80% chance to remove the last effect from the pool, if it's there.
- 0.01% chance to add Blab to the pool.
- Pick a random effect from the pool.
The rule 5 "80% chance to remove the last effect from the pool, if it's there." makes things more complicated but still doable. First we shall ignore the rule first, and calculate the probability by listing all possible pools as mentioned above. (From now on we shall assume that at least 100,000 cookies have been baked.)
Pool | Probability | |||
---|---|---|---|---|
# of effect | Chain | C. Frenzy | Blab | |
5 | X | X | X | P1=.03*.1*.0001 |
4 | X | X | P2=.03*.1*.9999 | |
4 | X | X | P3=.03*.9*.0001 | |
3 | X | P4=.03*.9*.9999 | ||
4 | X | X | P5=.97*.1*.0001 | |
3 | X | P6=.97*.1*.9999 | ||
3 | X | P7=.97*.9*.0001 | ||
2 | P8=.97*.9*.9999 |
Therefore, the probability of picking Frenzy is: P1/5+(P2+P3+P5)/4+(P4+P6+P7)/3+P8/2=0.478568. The probability of picking Lucky is the same as Frenzy. The probability of picking Chain,Click Frenzy and Blab are P5/5+(P2+P3)/4+P4/3=0.00974976, P5/5+(P2+P5)/4+P6/3=0.0330825 and P5/5+(P3+P5)/4+P7/3=0.00003226 respectively. These probabilities are called primitive probabilities.
Primitive probability | ||||
---|---|---|---|---|
Frenzy | Lucky | Chain | C. Fenzy | Blab |
0.478568 | 0.478568 | 0.00974976 | 0.033082 | 0.00003226 |
However, due to the rule 5, the actually probability is depend on last cookie. For example, if the last cookie is Frenzy, there are 80% chance that we shall apply the following table.
Pool | Probability | |||
---|---|---|---|---|
# of effect | C | CF | B | |
4 | X | X | X | P1=.03*.1*.0001 |
3 | X | X | P2=.03*.1*.9999 | |
3 | X | X | P3=.03*.9*.0001 | |
2 | X | P4=.03*.9*.9999 | ||
3 | X | X | P5=.97*.1*.0001 | |
2 | X | P6=.97*.1*.9999 | ||
2 | X | P7=.97*.9*.0001 | ||
1 | P8=.97*.9*.9999 |
From the table, we can calculate the conditional probability:
Conditional probability | |||||
---|---|---|---|---|---|
Last Cookie | Frenzy | Lucky | Chain | C. Frenzy | Blab |
Frenzy | 0 | 0.935954 | 0.0144995 | 0.0494984 | 0.0000478583 |
Remember that the actual probability should be a combination of 20% of primitive probability and 80% of conditional probability:
Actual probability | |||||
---|---|---|---|---|---|
Last Cookie | Frenzy | Lucky | Chain | C. Frenzy | Blab |
Frenzy | 0.0957135 | 0.844477 | 0.0135496 | 0.0494984 | 0.00004783 |
The actual probability of Lucky is the same as Frenzy. For conditional probability of Chain, we shall consider the following table:
Pool | Probability | |||
---|---|---|---|---|
# of effect | C | CF | B | |
4 | X | X | X | P1=.03*.1*.0001 |
3 | X | X | P2=.03*.1*.9999 | |
3 | X | X | P3=.03*.9*.0001 | |
2 | X | P4=.03*.9*.9999 | ||
4 | X | X | P5=.97*.1*.0001 | |
3 | X | P6=.97*.1*.9999 | ||
3 | X | P7=.97*.9*.0001 | ||
2 | P8=.97*.9*.9999 |
And the actual probability is:
Actual probability | |||||
---|---|---|---|---|---|
Last Cookie | Frenzy | Lucky | Chain | C. Frenzy | Blab |
Chain | 0.482368 | 0.482368 | 0.00194995 | 0.0332825 | 0.000032452 |
Repeating the process, we can build up the following table. Notice that since we add Blab after rule 5, the conditional/actual probability when last cookie is blab is the same as primitive probability.
Current Cookie | |||||
---|---|---|---|---|---|
Last Cookie | Frenzy | Lucky | Chain | Click Frenzy | Blab |
Frenzy | .095713547 | .8444769536 | .013549572 | .0462151886 | .0000447386 |
Lucky | .8444769536 | .095713547 | .013549572 | .0462151886 | .0000447386 |
Chain | .482367547 | .482367547 | .001949952 | .033282502 | .000032452 |
Click Frenzy | .4917004136 | .4917004136 | .009949752 | .006616502 | .0000329186 |
Blab/None | .478567735 | .478567735 | .00974976 | .03308251 | .00003226 |
The table above is a transition matrix, the long term (stationary) probability can be found as the eigenvector of the transition matrix with eigenvalue 1.
The Long Term Probability | ||||
---|---|---|---|---|
Frenzy | Lucky | Chain | Click Frenzy | Blab |
47.121495% | 47.121495% | 1.3236432% | 4.4289617% | 0.0044052% |
Using this, we can obtain the following table shows the final result:
Current Cookie | ||||||
---|---|---|---|---|---|---|
Last Cookie | Frenzy | Lucky | Chain | Click Frenzy | Blab | Total |
Frenzy | 4.5101654% | 39.793016% | 0.6384761% | 2.1777288% | 0.0021082% | 47.121495% |
Lucky | 39.793016% | 4.5101654% | 0.6384761% | 2.1777288% | 0.0021082% | 47.121495% |
Chain | 0.6384825% | 0.6384825% | 0.0025810% | 0.0440542% | 0.0000430% | 1.3236432% |
Click Frenzy | 2.1777223% | 2.1777223% | 0.0440671% | 0.0293042% | 0.0001458% | 4.4289617% |
Blab | 0.0021082% | 0.0021082% | 0.0000429% | 0.0001457% | 0.0000001% | 0.0044052% |
Total | 47.121495% | 47.121495% | 1.3236432% | 4.4289617% | 0.0044052% | 100% |
Edit
For wrath cookies, the procedure of determining effect is different:
- Add Lucky, Clot and Ruin to a pool.
- 30% chance to add Elder Frenzy and Chain to the pool.
- If previous step fails (70%), 3% chance to add Chain to the pool, if at least 100,000 cookies have been baked this game.
- 10% chance to add Click Frenzy to the pool.
- 80% chance to remove the last effect from the pool, if it's there.
- 0.01% chance to add Blab to the pool.
- Pick a random effect from the pool.
However, the transition matrix can (assuming at least 100,000 cookies have been baked) still be made:
Current Cookie | |||||||
---|---|---|---|---|---|---|---|
Last Cookie | Lucky | Clot | Ruin | E.Frenzy | Chain | C. Frenzy | Blab |
Lucky | .056962699 | .383759471 | .383759471 | .070598646 | .077087491 | .027805042 | .000027181 |
Clot | .383759471 | .056962699 | .383759471 | .070598646 | .077087491 | .027805042 | .000027181 |
Ruin | .383759471 | .383759471 | .056962699 | .070598646 | .077087491 | .027805042 | .000027181 |
E. Frenzy | .296413112 | .296413112 | .296413112 | .011799806 | .075743544 | .023194559 | .000022754 |
Chain | .297757059 | .297757059 | .297757059 | .070598646 | .012828785 | .023278556 | .000022835 |
C. Frenzy | .290223955 | .290223955 | .290223955 | .059799006 | .065027901 | .004478916 | .000022311 |
Blab | .284813495 | .284813495 | .284813495 | .058999029 | .064143927 | .022394582 | .000021977 |
And the long term probability can be calculated:
The Long Term Probability | ||||||
---|---|---|---|---|---|---|
Lucky | Clot | Ruin | E. Frenzy | Chain | Click Frenzy | Blab |
27.832181% | 27.832181% | 27.832181% | 6.6406924% | 7.2047971% | 2.6553223% | 0.0026445% |
The final table then can be obtained:
Current | |||||||
---|---|---|---|---|---|---|---|
Last | Lucky | Clot | Ruin | E. Frenzy | Chain | C. Frenzy | Blab |
Lucky | 1.5853962% | 10.680863% | 10.680863% | 1.9649143% | 2.1455130% | 0.7738750% | 0.0007565% |
Clot | 10.680863% | 1.5853962% | 10.680863% | 1.9649143% | 2.1455130% | 0.7738750% | 0.0007565% |
Ruin | 10.680863% | 10.680863% | 1.5853962% | 1.9649143% | 2.1455130% | 0.7738750% | 0.0007565% |
E.Frenzy | 1.9683883% | 1.9683883% | 1.9683883% | 0.0783589% | 0.5029896% | 0.1540279% | 0.0001511% |
Chain | 2.1452792% | 2.1452792% | 2.1452792% | 0.5086489% | 0.0924288% | 0.1677173% | 0.0001645% |
C.Frenzy | 0.7706381% | 0.7706381% | 0.7706381% | 0.1587856% | 0.1726700% | 0.0118930% | 0.0000592% |
Blab | 0.0007532% | 0.0007532% | 0.0007532% | 0.0001560% | 0.0001696% | 0.0000592% | 0.0000001% |
Total | 27.832181% | 27.832181% | 27.832181% | 6.6406924% | 7.2047971% | 2.6553223% | 0.0026445% |
GrandmapocalypseEdit
There are four phases in Grandmapocalypse: Appeased, Awoken, Displeased, Angered. For the first phase all the cookie will be golden and for the last phased all cokied will be wrath.
In two middle phases, the probability of wrath cookie is 1/3 and 2/3 respectively. Thus the transition matrix of these two phase are a linear combination of transition matrix of Appeased phase (pure golden cookie) and transition matrix of Awoken phase (pure wrath cookie).
Let us show the golden transition matrix and wrath transition matrix first:
Golden | Current Cookie | |||||||
---|---|---|---|---|---|---|---|---|
Last Cookie | Frenzy | Lucky | Clot | Ruin | E. Frenzy | Chain | C. Frenzy | Blab |
Frenzy | .095713547 | .8444769536 | 0 | 0 | 0 | .013549572 | .0462151886 | .0000447386 |
Lucky | .8444769536 | .095713547 | 0 | 0 | 0 | .013549572 | .0462151886 | .0000447386 |
Clot/None | .478567735 | .478567735 | 0 | 0 | 0 | .00974976 | .03308251 | .00003226 |
Ruin/None | .478567735 | .478567735 | 0 | 0 | 0 | .00974976 | .03308251 | .00003226 |
E.Frenzy/None | .478567735 | .478567735 | 0 | 0 | 0 | .00974976 | .03308251 | .00003226 |
Chain | .482367547 | .482367547 | 0 | 0 | 0 | .001949952 | .033282502 | .000032452 |
C.Frenzy | .4917004136 | .4917004136 | 0 | 0 | 0 | .009949752 | .006616502 | .0000329186 |
Blab/None | .478567735 | .478567735 | 0 | 0 | 0 | .00974976 | .03308251 | .00003226 |
Wrath | Current Cookie | |||||||
---|---|---|---|---|---|---|---|---|
Last Cookie | Frenzy | Lucky | Clot | Ruin | E. Frenzy | Chain | C. Frenzy | Blab |
Frenzy
/none | 0 | .284813495 | .284813495 | .284813495 | .058999029 | .064143927 | .022394582 | .000021977 |
Lucky | 0 | .056962699 | .383759471 | .383759471 | .070598646 | .077087491 | .027805042 | .000027181 |
Clot | 0 | .383759471 | .056962699 | .383759471 | .070598646 | .077087491 | .027805042 | .000027181 |
Ruin | 0 | .383759471 | .383759471 | .056962699 | .070598646 | .077087491 | .027805042 | .000027181 |
E.Frenzy | 0 | .296413112 | .296413112 | .296413112 | .011799806 | .075743544 | .023194559 | .000022754 |
Chain | 0 | .297757059 | .297757059 | .297757059 | .070598646 | .012828785 | .023278556 | .000022835 |
C.Frenzy | 0 | .290223955 | .290223955 | .290223955 | .059799006 | .065027901 | .004478916 | .000022311 |
Blab | 0 | .284813495 | .284813495 | .284813495 | .058999029 | .064143927 | .022394582 | .000021977 |
Then combine them in G:W=2:1 (Awoken) and G:W=1:2 (Displeased):
Awoken | Current Cookie | |||||||
---|---|---|---|---|---|---|---|---|
Last Cookie | Frenzy | Lucky | Clot | Ruin | E. Frenzy | Chain | C. Frenzy | Blab |
Frenzy | 0.0638090 | 0.6579225 | 0.0949378 | 0.0949378 | 0.0196663 | 0.0196663 | 0.0382750 | 0.0000372 |
Lucky | 0.5629846 | 0.0827966 | 0.1279198 | 0.1279198 | 0.0235329 | 0.0347289 | 0.0400785 | 0.0000389 |
Clot | 0.3190452 | 0.4469650 | 0.0189876 | 0.1279198 | 0.0235329 | 0.0321957 | 0.0313234 | 0.0000306 |
Ruin | 0.3190452 | 0.4469650 | 0.0189876 | 0.1279198 | 0.0235329 | 0.0321957 | 0.0313234 | 0.0000306 |
E.Frenzy | 0.3190452 | 0.4178495 | 0.0988044 | 0.0988044 | 0.0039333 | 0.0317477 | 0.0297865 | 0.0000291 |
Chain | 0.3215784 | 0.4208307 | 0.0992524 | 0.0992524 | 0.0235329 | 0.0055762 | 0.0299479 | 0.0000292 |
C.Frenzy | 0.3278003 | 0.4245416 | 0.0967413 | 0.0967413 | 0.0199330 | 0.0283091 | 0.0059040 | 0.0000294 |
Blab | 0.3190452 | 0.4139830 | 0.0949378 | 0.0196663 | 0.0196663 | 0.0278811 | 0.0295199 | 0.0000288 |
Displeased | Current Cookie | |||||||
---|---|---|---|---|---|---|---|---|
Last Cookie | Frenzy | Lucky | Clot | Ruin | E. Frenzy | Chain | C. Frenzy | Blab |
Frenzy | 0.0319045 | 0.4713680 | 0.1898757 | 0.1898757 | 0.0393327 | 0.0472791 | 0.0303348 | 0.0000296 |
Lucky | 0.2814923 | 0.0698796 | 0.2558396 | 0.2558396 | 0.0470658 | 0.0559082 | 0.0339418 | 0.0000330 |
Clot | 0.1595226 | 0.4153622 | 0.0379751 | 0.2558396 | 0.0470658 | 0.0546416 | 0.0295642 | 0.0000289 |
Ruin | 0.1595226 | 0.4153622 | 0.2558396 | 0.0379751 | 0.0470658 | 0.0546416 | 0.0295642 | 0.0000289 |
E.Frenzy | 0.1595226 | 0.3571313 | 0.1976087 | 0.1976087 | 0.0078665 | 0.0537456 | 0.0264905 | 0.0000259 |
Chain | 0.1607892 | 0.3592939 | 0.1985047 | 0.1985047 | 0.0470658 | 0.0092025 | 0.0266132 | 0.0000260 |
C.Frenzy | 0.1639001 | 0.3573828 | 0.1934826 | 0.1934826 | 0.0398660 | 0.0466685 | 0.0051914 | 0.0000258 |
Blab | 0.1595226 | 0.3493982 | 0.1898757 | 0.1898757 | 0.0393327 | 0.0460125 | 0.0259572 | 0.0000258 |
The final normalized table are presented below:
Awoken | Current | |||||||
---|---|---|---|---|---|---|---|---|
Last | Frenzy | Lucky | Clot | Ruin | E. Frenzy | Chain | C. Frenzy | Blab |
Frenzy | 2.090926% | 21.55913% | 3.110970% | 3.110970% | 0.644436% | 0.996633% | 1.254214% | 0.001217% |
Lucky | 21.20543% | 3.118624% | 4.818239% | 4.818239% | 0.886392% | 1.308101% | 1.509599% | 0.001465% |
Clot | 3.292897% | 4.613170% | 0.195973% | 1.320273% | 0.242885% | 0.332295% | 0.323291% | 0.000315% |
Ruin | 3.292897% | 4.613170% | 1.320273% | 0.195973% | 0.242885% | 0.332295% | 0.323291% | 0.000315% |
E.Fren. | 0.692677% | 0.907191% | 0.214514% | 0.214514% | 0.008539% | 0.068927% | 0.064669% | 0.000063% |
Chain | 1.015420% | 1.328821% | 0.313401% | 0.313401% | 0.074308% | 0.017608% | 0.094564% | 0.000092% |
C.Fren. | 1.177110% | 1.524501% | 0.347392% | 0.347392% | 0.071578% | 0.101656% | 0.021201% | 0.000106% |
Blab | 0.001140% | 0.001480% | 0.000339% | 0.000339% | 0.000070% | 0.000100% | 0.000106% | 0.000000% |
Total | 32.76850% | 37.66609% | 10.32110% | 10.32110% | 2.171094% | 3.157614% | 3.590935% | 0.003574% |
Displ. | Current | |||||||
---|---|---|---|---|---|---|---|---|
Last | Frenzy | Lucky | Clot | Ruin | E. Frenzy | Chain | C. Frenzy | Blab |
Frenzy | 0.559120% | 8.260622% | 3.327530% | 3.327530% | 0.689297% | 0.828557% | 0.531611% | 0.000518% |
Lucky | 8.745448% | 2.171032% | 7.948467% | 7.948467% | 1.462247% | 1.736964% | 1.054508% | 0.001026% |
Clot | 3.103346% | 8.080440% | 0.738767% | 4.977094% | 0.915615% | 1.062995% | 0.575141% | 0.000562% |
Ruin | 3.103346% | 8.080440% | 4.977094% | 0.738767% | 0.915615% | 1.062995% | 0.575141% | 0.000562% |
E.Fren. | 0.698358% | 1.563449% | 0.865091% | 0.865091% | 0.034438% | 0.235287% | 0.115970% | 0.000113% |
Chain | 0.822308% | 1.837500% | 1.015193% | 1.015193% | 0.240704% | 0.047063% | 0.136105% | 0.000133% |
C.Fren. | 0.492380% | 1.073631% | 0.581251% | 0.581251% | 0.119763% | 0.140199% | 0.015596% | 0.000078% |
Blab | 0.000477% | 0.001045% | 0.000568% | 0.000568% | 0.000118% | 0.000138% | 0.000078% | 0.000000% |
Total | 17.52478% | 31.06816% | 19.45396% | 19.45396% | 4.377797% | 5.114199% | 3.004149% | 0.002992% |