1 The game in numbers
Cookie Clicker is an idle game by Orteil. You bake cookies and spend them on buildings and upgrades, which bake more cookies. A run is the period between two resets.
Each building type has a base price . Each copy costs 15% more than the copy before it:
Buildings and upgrades set the cookies per second , also called CpS. Clicks, golden cookies and wrinklers add more. The sum is the income.
At any time you can ascend. Ascension ends the run. In return you keep prestige, which grows with the cube root of all cookies ever baked, :
After the heavenly upgrade Legacy, each prestige level adds 1% to production in all later runs. Each new level also gives one heavenly chip, which buys permanent upgrades.
Four decisions occur many times in a game: what to buy next, when to keep cookies in the bank for golden cookies, how to spend heavenly chips, and when to ascend. Chapters 2 to 5 give a rule for each decision. Chapters 6 to 9 cover the other systems. The paper contains the complete proofs. The Tools page has the patcher for Cookie Monster+, a mod that plays by these rules.
2 What to buy next
You want two items, and , and you cannot buy either now. Item costs and adds to the income . Which item do you buy first?
If you buy first, you save at income . Then you save at the higher income . The other order is symmetric. Both orders end in the same state, so the faster order is better. Compare the two total times:
The comparison simplifies to one index for each item.
Rule 1 (pairwise exchange). Buy first if and only if , where
The first term is the time to save for the item. The second term is its payback time: the time that the item needs to earn back its price. Cookie Monster shows the sum as the payback period. When you cannot buy any of the items, the payback period gives the same order as . Thus the usual community rule is exactly correct in that case.
The rule is local. changes as increases, so no single sorted list is correct for the whole game. At each decision, buy the item with the smallest .
A large bank changes the rule. If the bank holds enough for either item but not for both, buy the item with the larger first. In simulations this difference changes the time to a goal by less than 0.4%.
Which purchase first
Set the income and the two items. The display compares the two orders.
3 Golden cookies and the bank
A golden cookie appears on the screen at random times. A click gives one of several effects. The most frequent are Frenzy, which multiplies production by 7 for 77 seconds, and Lucky!, which pays
cookies, where is the bank. Below the cap, at a bank of 6,000 seconds of CpS, the payout is 15% of the bank. Thus each cookie in the bank earns a part of every Lucky! payout.
Lucky! payout
Move the bank. The payout grows with the bank until the cap.
First, find how often golden cookies appear. The game waits at least minutes and at most minutes. In each frame after the minimum, the chance of a golden cookie is . Here counts frames, and the window has frames at 30 frames per second. The chance that no cookie appears before the fraction of the window is close to . One integral then gives the mean fraction:
At the base frequency, a golden cookie appears every 447 seconds on average. Lucky day and Serendipity each halve both limits. With both upgrades, the mean interval is 121 seconds.
Golden cookie interval
Select the frequency upgrades.
About 42% of golden cookies give Lucky!. They occur at the rate , where is the interval. Thus a banked cookie earns per second, where multiplies golden cookie gains. A cookie spent on item earns per second.
Rule 2 (the Lucky! bank). Spend the cookie if and only if
Here is all the income that the item adds: its CpS, its click power at the clicker's rate, and the extra income that Frenzies and other golden effects make from both. With both frequency upgrades, is about 1,900 seconds. Early in a run, payback times are seconds or minutes, so spend every cookie. Late in a run, payback times are hours, so keep the bank.
4 Heavenly chips
Heavenly upgrades cost chips. Each upgrade multiplies the speed of every later run. Upgrade costs chips and multiplies the speed by . New chips arrive faster at a higher speed, so an upgrade bought early also shortens the wait for every later upgrade.
Rule 3 (ratio rule). Buy the upgrades in decreasing order of
To prove the rule, swap two adjacent upgrades and . Every other wait stays the same. The swap shortens the total time if and only if . This is Smith's rule from the scheduling of jobs.
The rule tells you to save. Do not buy a cheap upgrade with a low ratio while an upgrade with a higher ratio is still too expensive. Value an upgrade that needs a parent together with the parent, as one block.
5 When to ascend
Ascension is a trade. It ends the run, and in return every later run is faster. If a run at speed 1 bakes cookies in time , the same run at speed bakes cookies in time . A faster run follows the same path in less time.
Late in the game, the speed is proportional to prestige. Suppose that the cookies of a run grow like , where is the growth exponent of the run, and write . A telescoping lower bound on the total time then gives the best schedule. Each run multiplies all-time cookies by the same factor , the root of
For , , and for , . Prestige grows by the cube root of in each run: about 2.0 and 2.6 times.
Growth in each run
Select the growth exponent of the current run.
A familiar rule says: ascend when the marginal rate falls to the average rate. This is the marginal value theorem. It is correct only at , because it ignores that later runs become longer or shorter. At , it waits 6.5 times too long.
Early in the game, prestige changes the speed very little, and a reset only loses time. If every run has the same speed, one long run is the fastest way to bake any number of cookies. The mod therefore uses a dynamic program over all future ascensions, including the heavenly upgrades that each ascension can buy. Late in the game it agrees with the formula above, and early in the game it does not reset too soon.
6 Achievements and milk
Each achievement, except the shadow achievements, adds 4% milk. Kitten upgrades turn milk into production. With kitten factors , milk and a milk multiplier , production carries the factor . One more achievement multiplies production by
On an observed save with eight kittens and 952% milk, one achievement adds 2.14% to production. The mod takes every achievement that needs only an action at once. Examples are a click on the news ticker in a narrow window, one of Santa's helper grandmas, and a gift code sent to yourself.
Some achievements cost time, for example a special run. The rescaling of time also gives these a price. A permanent gain of a share of income makes all later play times faster. Over the remaining play time , the gain is worth seconds. A delay of seconds costs seconds.
Rule 4 (worth of an achievement). An action that delays play by seconds and earns achievements worth pays if and only if
Nobody knows in advance. With no other information, the median remaining time equals the time played so far, so the mod uses that estimate. After 77 hours of play, one achievement is worth 1.66 hours.
Neverclick and Hardcore need a Born again run, which starts without prestige or upgrades. A simulation of that run needs about 4 hours for both achievements, so the mod starts one after about 93 hours of play. Wrinklesquisher and Moistburster need 50 and 200 wrinklers burst in one run. Such a spree costs some minutes of income, so the mod does it when the run is long enough.
Worth of an achievement
Set the kittens, the milk and the hours played.
7 Godzamok
Godzamok is a god in the Pantheon minigame. When you sell buildings, Godzamok gives a 10-second buff to click power. Each building sold adds in the first slot, 0.5% in the second slot and 0.25% in the third slot. Sales during the buff add to it without a limit, but they do not make it longer.
Sell all copies of a building whose next copy costs , and buy them back in the same frame. Production does not change. A sale returns 25% of the price of the next copy, so the refund is of the cost to buy the copies back. The round trip therefore costs
The round trip adds to the buff. This is worth cookies, where is the click income without the buff and is the remaining time of the buff. Late in a run, this value is much larger than the cost for every building type except the newest ones.
Suppose that you cycle buildings in each of the frames of one buff. The multiplier increases by in each frame, so its average over the buff is
The mouse upgrades make a click worth 15% of CpS, so 20 clicks per second bring 3 times CpS. On a late-game save, the mod cycled about 2,200 buildings per frame in 3 milliseconds. The buff averaged ×3,329, and the income increased to about 22,000 times CpS.
Godzamok buff
Select the slot and the number of buildings that the mod sells and buys back in each frame.
8 Wrinklers and wrath
The Grandmapocalypse has three stages of wrath. At stage , each golden cookie is a wrath cookie with probability . Wrinklers also appear. A wrinkler takes a part of CpS and returns 1.1 times its contents when you burst it.
With wrinklers, a share of CpS withers. Each wrinkler receives that whole share, not a part of it. Thus wrinklers multiply the income from CpS by
Wrath cookies replace Frenzies with clots and Ruin. In return they bring Elder frenzies, which multiply production by 666 for 6 seconds, and cookie storms. The table gives the share of each effect at each stage, simulated from the choice rule of the game.
| Stage | Frenzy | Lucky! | Building | Click frenzy | Storm | Chain | Elder frenzy | Clot | Ruin | Cursed |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | .422 | .422 | .100 | .040 | .008 | .008 | – | – | – | – |
| 1 | .294 | .341 | .076 | .032 | .024 | .023 | .017 | .090 | .090 | .008 |
| 2 | .157 | .280 | .056 | .027 | .039 | .039 | .034 | .171 | .171 | .015 |
| 3 | – | .245 | .041 | .023 | .055 | .055 | .051 | .245 | .244 | .023 |
When most income comes from CpS, wrath wins. With ten wrinklers, the total income is about 2.8 times that of stage 0. Godzamok changes this result. With the Elder Pact, an Elder Pledge costs at most cookies, and it becomes available again when it ends. Thus the stage is a free choice.
Rule 5 (calm or wrath). Golden cookies multiply click income by 11.8 in calm and by 8.5 in wrath, and they multiply CpS income by 8.7 and 62.8. These values assume twelve wrinklers, doubled effect durations and a mean interval of 121 seconds. Calm earns more if and only if click income is more than about 16 times CpS.
With Godzamok, click income is thousands of times CpS, so the mod keeps a pledge active. It lets wrath reach stage 3 once for an achievement. Then it revokes the Elder Covenant, because the covenant costs 5% of CpS and a pledge costs nothing.
Wrinklers and the stage
Set the wrinklers and the ratio of click income to CpS.
9 Minigames and seasons
Grimoire. Below its cap , magic regenerates at the rate . To fill an interval of magic from to takes
which decreases in . Thus a spell that costs is cast most often when you cast it at full magic. The mod casts Force the Hand of Fate at full magic. Cheaper spells would reach the spell-count achievements sooner, but they would lose more golden cookies than the achievements are worth.
Pantheon. The mod tries every order of the useful gods with the CpS formula of the game and the income model. It moves gods only when income increases by more than 1%. Each ascension restores three worship swaps, but from zero swaps the next swap takes 16 hours. When a much better arrangement waits for a swap, the mod spends the next sugar lump on a refill.
Garden. New seeds come only from mutations, and mutations grow only in empty tiles next to mature parent plants. Plant parent kind A on the tiles where is even and is even. Plant kind B where is even and is odd, and leave the other tiles empty. Then every empty tile touches both kinds, on every plot of at least 2 × 2 tiles. The mod breeds Thumbcorn first, which adds 2% click power, and then Cronerice, Gildmillet, Clover and Golden clover. Wood chips give three mutation rolls in each tick.
Breeding layout
Select the farm level. A and B mark the parent tiles.
Stock Market. Prices return toward the resting value . A purchase costs at most 20% extra and a sale costs nothing. Thus a purchase below and a sale at return at least . The office upgrades open loans. Each loan multiplies CpS for a period and then divides it for a longer period.
| Loan | CpS | For | Then | For | Down payment |
|---|---|---|---|---|---|
| 1 | ×1.5 | 2 h | ×0.25 | 4 h | 20% of bank |
| 2 | ×2 | 40 s | ×0.1 | 40 min | 40% of bank |
| 3 | ×1.2 | 48 h | ×0.8 | 120 h | 50% of bank |
If the run ends before the boost ends, the penalty never applies. The mod takes a loan when the planner expects the run to end in time. It ascends early when a loan is about to end and an early ascension costs less than the penalty.
Dragon. To buy back copies of a building whose next copy costs takes , about for . The mod trains the dragon toward Radiant Appetite, which doubles production, when the buildings are available and the buy-back costs at most one hour of income.
Seasons. Christmas gives 14 levels of Santa, which cost about cookies in total. Valentine's Day gives seven heart cookies that add 2% each, and Easter gives eggs. Each run visits these seasons in that order and then stays in Christmas for the reindeer.
Sugar lumps. Lumps go first to the minigames, then to a Sugar frenzy in each run, then to cursor levels for the first loan, and then to building levels by gain per lump.