How do Golden Cookies work?
Without any upgrades or anything, a Golden Cookie spawns m
minutes after the last one disappeared, where m
is a random number between 5 and 15. Each of the upgrades Lucky day and Serendipity cut that time in half, and the debug upgrade Gold hoard makes them spawn pretty much constantly instead. Also, if your last cookie gave you a cookie chain, then the next one spawns 3 seconds later. This means that you are not more likely to get a Golden Cookie if you haven't clicked on one in a while.
Without any upgrades, again, a Golden Cookie lasts for 13 seconds before disappearing. The Lucky day and Serendipity upgrades both double that. If your last cookie gave you a cookie chain, then it disappears after 6 seconds instead.
When you get what appears to be a flat number of cookies, it either gives you 15% of your banked cookies or the equivalent of 20 minutes of cookie production, whichever is lower.
The bonus you get is randomly chosen each time you click the cookie. It normally chooses between Frenzy, which multiplies your production by 7, and Lucky, which gives you cookies as I just described. There is also a small chance of getting a Click frenzy, which multiplies your cookies per click by 777, and an even smaller chance of getting a Cookie chain, which gives you 6 the first time you get it, 66 the second time, etc. until you get something else. As Michael Madsen's answer points out, the effects appear to alternate because every time you click a golden cookie, there's an 80% chance that it will remove the previous effect from the list of possible effects before it picks which one actually happens.
Once the Grandmapocalypse begins, you also have a chance of getting Ruin, which makes you lose half as many cookies as you would gain from a Lucky cookie, Clot, which cuts your production in half, and Elder Frenzy, which multiplies your production by 666 for a few seconds.
murgatroid99 did an excellent job of explaining how the cookies appear, so I'm going to skip that part.
Using the source code for the current version (v.1.0375), I sat down and calculated the actual odds a bit more exactly.
When you click on a cookie, the game generates a list of possible outcomes for that cookie; certain outcomes are less likely to appear than others. Once this list is generated, each outcome on the list has an equal probability of being chosen.
The descriptions below are the normal effects; if you have the Get lucky upgrade, the time-based effects will have double duration.
For a golden cookie:
- 100% Frenzy (7x cookies/second for 77 seconds)
- 100% Lucky (get 13 cookies and 10% of total cookies or 20 minutes worth of production, whichever is lower)
- 10% Click Frenzy (clicks worth 777x normal for 13 seconds)
If you have earned at least 100,000 cookies in total:
- 1% Chain Cookie (get 6 cookies and 10 times whatever the previous cookie in the chain was worth; new cookie will spawn in 3 seconds if chain continues)
For a wrath cookie (red grandmapocalypse cookies):
- 100% Clot (cookies/second halved for 66 seconds)
- 100% Lucky
- 100% Ruin (lose 13 cookies and 5% of total cookies or 10 minutes worth of production, whichever is lower)
- 30% Chain Cookie/Elder Frenzy (666x cookies/second for 6 seconds)
- 10% Click Frenzy
- 0.7% Chain Cookie (actually 1%, but only if the previous 30% chance for Chain Cookie/Elder Frenzy failed)
When the grandmatriarchs are awoken/displeased/angered, 33/66/100% of cookies will be wrath cookies.
This results in these probabilities for a cookie having a specific set of possible outcomes:
Golden cookies:
- 89.1% Frenzy/Lucky
- 09.9% Frenzy/Lucky/Click Frenzy
- 00.9% Frenzy/Lucky/Chain Cookie
- 00.1% Frenzy/Lucky/Click Frenzy/Chain Cookie
Wrath cookies:
- 62.559% Clot/Lucky/Ruin
- 27.000% Clot/Lucky/Ruin/Chain Cookie/Elder Frenzy
- 06.951% Clot/Lucky/Ruin/Click Frenzy
- 03.000% Clot/Lucky/Ruin/Chain Cookie/Elder Frenzy/Click Frenzy
- 00.441% Clot/Lucky/Ruin/Chain Cookie
- 00.049% Clot/Lucky/Ruin/Click Frenzy/Chain Cookie
To determine the odds of a given outcome, divide each of these probabilities with the number of outcomes in that set, and add together the numbers where that option appears. Rounded to 3 decimals, that gives the following odds:
Golden cookie:
- 48.175% Frenzy (89.1%/2 + 9.9%/3 + 0.9%/3 + 0.1%/4)
- 48.175% Lucky
- 03.325% Click Frenzy
- 00.325% Chain Cookie
Wrath cookie:
- 28.611% Clot
- 28.611% Lucky
- 28.611% Ruin
- 06.020% Chain Cookie
- 05.900% Elder Frenzy
- 02.248% Click Frenzy
However, it's a bit more complicated in practice.
There is an 80% probability that the most recent golden cookie effect is removed from the list of possible outcomes. To determine the probabilities for a cookie given the most recent effect, you would need to adjust the probabilities for the possible sets of outcomes accordingly.
As an example, suppose that the most recent effect was Lucky, and a Golden Cookie appears; this cookie then has the following probabilities for the sets of outcomes:
- 71.28% Frenzy
- 17.82% Frenzy/Lucky
- 07.92% Frenzy/Click Frenzy
- 01.98% Frenzy/Lucky/Click Frenzy
- 00.72% Frenzy/Chain Cookie
- 00.18% Frenzy/Lucky/Chain Cookie
- 00.08% Frenzy/Click Frenzy/Chain Cookie
- 00.02% Frenzy/Lucky/Click Frenzy/Chain Cookie
which results in these odds for the individual outcomes:
- 85.262% Frenzy
- 09.635% Lucky
- 04.652% Click Frenzy
- 00.452% Chain Cookie
(Calculating the odds given another previous outcome is left as an exercise for the reader.)