## Edit

__CALCULATING THE PURCHASING POWER TO DETERMINE HOW TO SPEND YOUR TOKENS, an article by mpmslc.__

Ever want to know how to best spend your tokens when purchasing guardian powers at the edge of infinity? Are you confused and don't know which 'online optimizer' to use? Here is an article that breaks down how to calculate what I like to call the purchasing power.

All the calculations in my optimizer http://repl.it/e2R/26 are based on everything written in this article.

To begin, I will abbreviate purchasing power with **PP** and express it in the following equation:

**PP = γΔ / ($Σ)**

This equation states that the purchasing power (**PP**) is equal to a factor (**γ**) multiplied by a change (**Δ**) divided by a cost (**$**) which is multiplied by a total (**Σ**).

There are different factors (**γ**) used to bump up or reduce the final value of the purchasing power (**PP**) depending on how much of an importance is placed on different benefits: such as DPS (damage per second), gold, tokens or time. As a default, the following factors have been assigned:

DPS Factor = 1.000

Gold Factor = 0.275

Token Factor = 5.000

Time Factor = 3.000

These values may be changed based on how important you feel one is above another. Of course, the more important the benefit, the higher you would want to assign the factor; the less important the benefit, the lower you would want to assign the factor.

When you level up a guardian power, a change (**Δ**) it’s benefit occurs. For instance, when you purchase a level in Train Heroes a change (**Δ**) of 11% is applied to it’s total DPS. This starts out with a built in value. For Prism, a corrected change (**Δ**) will be required.

The cost (**$**) is defined simply by the amount of tokens is required to level up a guardian power and is expressed in the following equation:

**$ = B**_{1}**^E**_{1}** + A**_{1} (rounded down to the nearest integer)

This equation states that the cost (**$**) is equal to a built-in base number (**B**_{1}) raised to the power of a built-in exponent (**E**_{1}) and then added by a built-in number (**A**_{1}).

The total (**Σ**) is defined by how much benefit the guardian power is currently granting you at your current level. It is the overall multiplier and is expressed in the following equation:

**Σ = LΔM**_{2}** + A**_{2 }

This equation states that the total (**Σ**) is equal to the level (**L**) of the guardian power multiplied by the change (**Δ**) multiplied by a built-in number (**M**_{2}) and then added by a built-in number (**A**_{2}).

__GUILDED CHESTS__

Cost to level is expressed as follows:

**$ = B**_{1}**^E**_{1}** + A**_{1} (rounded down to the nearest integer)

where **B**_{1}** = L + 1** (**L** = level of this guardian power) and

where **E**_{1}** = 1.0** and

where **A**_{1}** = 0**. So therefore:

**$ = (L + 1)**^{1.0}** + 0** -- Simplified:

**$ = L + 1**

Since each level gives 25% boost to amount of gold gained from chests:

**Δ = 25%'**

Current total benefit is expressed as follows:

**Σ = LΔM**_{2}** + A**_{2}

where **M**_{2}** = 1** and

since the benefit must be 100% (not 0%) at level 0:

**A**_{2}** = 100%**. So therefore:

**Σ = L * 25% * 1 + 100%** -- Simplified:

**Σ = L / 4 + 1**

Since this guardian power yields GOLD:

**γ = 0.275'**

**PP = γΔ / ($Σ)**

**PP = 0.275 * 25% / [(L + 1)(L / 4 + 1)]** -- Simplified:

**PP = 0.275 / (L**^{2}** + 5L + 4)**

__MIDAS TOUCH__

Cost to level is expressed as follows:

**$ = B**_{1}**^E**_{1}** + A**_{1} (rounded down to the nearest integer)

where **B**_{1}** = L + 1** (**L** = level of this guardian power) and

where **E**_{1}** = 1.0** and

where **A**_{1}** = 0**. So therefore:

**$ = (L + 1)**^{1.0}** + 0** -- Simplified:

**$ = L + 1**

Since each level gives 5% boost to amount of gold gained from all sources:

**Δ = 5%**

Current total benefit is expressed as follows:

**Σ = LΔM**_{2}** + A**_{2}

where **M**_{2}** = 1** and

since the benefit must be 100% (not 0%) at level 0:

**A**_{2}** = 100%**. So therefore:

**Σ = L * 5% * 1 + 100%** -- Simplified:

**Σ = L / 20 + 1**

Since this guardian power yields GOLD:

**γ = 0.275**

**PP = γΔ / ($Σ)**

**PP = 0.275 * 5% / [(L + 1)(L / 20 + 1)]** -- Simplified:

**PP = 0.275 / (L**^{2}** + 21L + 20) **

__FORCE MULTIPLY__

Cost to level is expressed as follows:

**$ = B**_{1}**^E**_{1}** + A**_{1} (rounded down to the nearest integer)

where **B**_{1}** = L + 1** (**L** = level of this guardian power) and

where **E**_{1}** = 1.6** and

where **A**_{1}** = 0**. So therefore:

**$ = (L + 1)**^{1.6}** + 0** -- Simplified:

**$ = (L + 1)**^{1.6}** **(rounded down to the nearest integer)

Since each level gives 1% boost to amount of infinity tokens gained:

**Δ = 1%**

Current total benefit is expressed as follows:

**Σ = LΔM**_{2}** + A**_{2}

where **M**_{2}** = 1** and

since the benefit must be 100% (not 0%) at level 0:

**A**_{2}** = 100%**. So therefore:

**Σ = L * 1% * 1 + 100%** -- Simplified:

**Σ = L / 100 + 1**

Since this guardian power yields TOKENS:

**γ = 5.000**

**PP = γΔ / ($Σ)**

**PP = 5.000 * 1% / [($ * (L / 100 + 1)]** -- Simplified:

**PP = 5 / [$ * (L + 100)] **

** **

__PRISM__

Cost to level is expressed as follows:

**$ = B**_{1}**^E**_{1}** + A**_{1} (rounded down to the nearest integer)

where **B**_{1}** = L + 1** (**L** = level of this guardian power) and

where **E**_{1}** = 1.6** and

where **A**_{1}** = 0**. So therefore:

**$ = (L + 1)**^{1.6}** + 0** -- Simplified:

**$ = (L + 1)**^{1.6}** **(rounded down to the nearest integer)

Since each level gives 1% boost to amount of infinity gems gained:

**Δ = 1%** (this will require a correction later)

Current total benefit is expressed as follows:

**Σ = LΔM**_{2}** + A**_{2}

where **M**_{2}** = 1** and

since the benefit must be 100% (not 0%) at level 0:

**A**_{2}** = 100%**. So therefore:

**Σ = L * 1% * 1 + 100%** -- Simplified:

**Σ = L / 100 + 1** (this will require a correction later)

This guardian power requires another phase of calculations for **Δ** and **Σ**, so more information is needed:

Level which Gems begin to drop (**L**_{G}) is the level at which gems begin to drop.

**L**_{G}** = 105**

Wormhole Level (**L**_{W}) is the level of your guardian power Wormhole.

Starting Level (**L**_{S}) is the level at which to begin for loop.

**L**_{S}** = ceiling (max (L**_{G}**,** **L**_{W}**), 5)**

Level at Infinity (**L**∞) is the level at which you decide to go infinity and start over again.

Frequency due to Jeweled (**F**_{J}) is the Infinity Gem Chance found in the in-game info, assuming it's maxed out.

**F**_{J}** = 50%**

Aidith Gems (**G**_{A}) is the total quantity of infinity gems Aidith (the final hero) has collected.

Gems Collected at Current Level (**G**_{L}) is the quantity of infinity gems collected during a 'run' (from starting level to level at infinity) at your current Prism level.

Gems Collected at Next Level (**G**_{L+1}) is the quantity of infinity gems you would collect during a run at your Prism's next level.

Spell Correction Multiplier (**S**_{M}) is a multiplier to adjust for spells casted during a run which increases your quantity of gems collected.

**S**_{M}** = 1.6**

The following 'for' loop is how to calculate the gems collected:

**for (level = L _{S}, level < L**∞

**, level + 5)**

**G**_{L}** += [(level - 105) / 25]**^{1.1}** * F**_{J}**ΣS**_{M} (rounded up to the nearest integer)

**G**_{L+1}** += [(level - 105) / 25]**^{1.1}** * F**_{J}**(Σ + Δ)S**_{M} (rounded up to the nearest integer)

New values are to be assigned to **Δ** and **Σ** as follows:

**Δ = (G**_{L+1}** - G**_{L}**) * 1% / 20**

This needs to be divided by 20 because virtually all of the time only one hero is doing nearly all of the damage at any given time. Nearly all the time it’s Aidith. This has been bar charted and proves this. The following is the above siplified:

**Δ = (G**_{L+1}** - G**_{L}**) / 2000'**

**Σ = G**_{A} *** 1% + 100%** -- Simplified:

**Σ = G**_{A} **/ 100 + 1**

Since this guardian power yields gems and the gems yield DPS:

**γ = 1.000**

**PP = γΔ / ($Σ)**

**PP = 1.000 * [(G**_{L+1}** - G**_{L}**) / 2000] / [$ * (G**_{A}** / 100 + 1)]** -- Simplified:

**PP = (G**_{L+1}** - G**_{L}**) / [5$ * (4G**_{A}** + 1)]**

** **

__BANKING__

Cost to level is expressed as follows:

**$ = B**_{1}**^E**_{1}** + A**_{1} (rounded down to the nearest integer)

where **B**_{1}** = L + 1** (**L** = level of this guardian power) and

where **E**_{1}** = 1.0** and

where **A**_{1}** = 0**. So therefore:

**$ = (L + 1)**^{1.0}** + 0** -- Simplified:

__ __

**$ = L + 1**

Since each level gives 15% boost to amount of gold gained while in idle mode:

**Δ = 15%**

Current total benefit is expressed as follows:

**Σ = LΔM**_{2}** + A**_{2}

where **M**_{2}** = 1** and

**A**_{2}** = 550%**. So therefore:

**Σ = L * 15% * 1 + 550%** -- Simplified:

**Σ = (3L + 110) / 20**

Since this guardian power yields GOLD:

**γ = 0.275**

**PP = γΔ / ($Σ)**

**PP = 0.275 * 15% / [(L + 1)(3L + 110) / 20]** -- Simplified:

**PP = 0.825 / (3L**^{2}** + 113L + 110)**

** **

__CONQUEST__

Cost to level is expressed as follows:

**$ = B**_{1}**^E**_{1}** + A**_{1} (rounded down to the nearest integer)

where **B**_{1}** = L + 1** (**L** = level of this guardian power) and

where **E**_{1}** = 1.0** and

where **A**_{1}** = 0**. So therefore:

**$ = (L + 1)**^{1.0}** + 0** -- Simplified:

**$ = L + 1**

Since each level gives 15% boost to amount of DPS gained while in idle mode:

**Δ = 15%**

Current total benefit is expressed as follows:

**Σ = LΔM**_{2}** + A**_{2}

where **M**_{2}** = 1** and

**A**_{2}** = 550%**. So therefore:

**Σ = L x 15% x 1 + 550%** -- Simplified:

**Σ = (3L + 110) / 20**

Since this guardian power yields DPS:

**γ = 1.000**

**PP = γΔ / ($Σ)**

**PP = 1.000 * 15% / [(L + 1)(3L + 110) / 20]** -- Simplified:

**PP = 3 / (3L**^{2}** + 113L + 110)**

** **

__TRAIN HEROES__

Cost to level is expressed as follows:

**$ = B**_{1}**^E**_{1}** + A**_{1} (rounded down to the nearest integer)

where **B**_{1}** = L + 1** (**L** = level of this guardian power) and

where **E**_{1}** = 0.0** and

where **A**_{1}** = 0**. So therefore:

**$ = (L + 1)**^{0.0}** + 0** -- Simplified:

**$ = 1**

Since each level gives 11% boost to amount of DPS gained:

**Δ = 11%**

Current total benefit is expressed as follows:

**Σ = LΔM**_{2}** + A**_{2}

where **M**_{2}** = 1** and

since the benefit must be 100% (not 0%) at level 0:

**A**_{2}** = 100%**. So therefore:

**Σ = L * 11% * 1 + 100%** -- Simplified:

**Σ = 11L / 100 + 1**

Since this guardian power yields DPS:

**γ = 1.000**

**PP = γΔ / ($Σ)**

**PP = 1.000 * 11% / [1 * (11L / 100 + 1)]** -- Simplified:

**PP = 11 / (11L + 100)**

** **

__WORMHOLE__

Cost to level is expressed as follows:

**$ = B**_{1}**^E**_{1}** + A**_{1} (rounded down to the nearest integer)

where **B**_{1}** = L + 1** (**L** = level of this guardian power) and

where **E**_{1}** = 1.5** and

where **A**_{1}** = 19**. So therefore:

**$ = (L + 1)**^{1.5}** + 19** (rounded down to the nearest integer)

Since level makes you start 1 level later:

**Δ = 1**

Current total benefit is expressed as follows:

**Σ = LΔM**_{2}** + A**_{2 }

where **M**_{2}** = -1**

Level at Infinity (**L**∞) is the level at which you decide to go infinity and start over again.

**A**_{2}** = L**∞. So therefore:

**Σ = L * 1 * -1 + L**∞ -- Simplified:

**Σ = L**∞ **- L**

Since this guardian power saves TIME:

**γ = 3.000'**__ __

**PP = γΔ / ($Σ)**

**PP = 3.000 * 1 / [$ * (L**∞** - L)]** -- Simplified:

**PP = 3 / [$ * (L∞ - L)]**

** **

__FINAL CALCULATIONS__

All the **PP** vaules are very small and get even smaller and smaller and approach 0 as you progress through the game, so to offset this, a scaling factor is applied to all **PP** values. I would like to set the smallest **PP** vaule to be equal to 100. So:

**PP**_{min}** = 100**

**PP**_{div}** = min(PP**_{gilded chests}**, PP**_{midas touch}**, PP**_{force multiply}**, PP**_{prism}**, PP**_{banking}**, PP**_{conquest}**, PP**_{train heroes}**, PP**_{wormhole}**)**

Every new **PP** values are updated as follows:

** **

**PP**_{new}** = PP**_{old}** * PP**_{min}** / PP**_{div}