# Hill Climb Racing

## Vehicles

What I found while playing the game is that vehicle upgrades were proportional to the square of the number of the upgrade. An upgrade is priced at $$B_{i} x^{2}$$ where $$x$$ was the upgrade number, and $$B_{i}$$ was a constant basis given a particular vehicle and class of upgrade. Let $$C_{i}$$ be the maximum number for a class of upgrade, then a vehicle's price when totally upgraded is:

$\sum_{i=1}^{4} \sum_{x=2}^{C_{i}} B_{i} x^{2}$

Once I pull out $$B_{i}$$ as a constant from the inner summation, I can reduce the inner summation to a polynomial by solving for coefficients. Call the polynomial $$p(y) = \sum_{x=2}^{y} x^{2}$$ for $$y \ge 2$$. I know right away that $$p(2) = 4$$ and $$p(y) - p(y-1) = y^2$$. Given $$p(y)$$ is cubic, I can say the following

$p(y) = a y^3 + b y^2 + c y + d$

Therefore

$p(y) - p(y-1) = a y^3 + b y^2 + c y + d - a (y-1)^3 - b (y-1)^2 - c (y-1) - d$

Substituting and reducing:

$y^2 = a (3 y^2 - 3 y + 1) + b (2 y - 1) + c$
$y^2 = 3 a y^2 - 3 a y + a + 2 b y - b + c$
$0 = (3 a - 1) y^2 + (2 b - 3 a) y + (a - b + c)$

Each coefficient gives me an equation, and I have a fourth considering:

$p(2) = 8 a + 4 b + 2 c + d = 4$

Solving, and substituting back

$p(y) = \frac{1}{3} y^3 + \frac{1}{2} y^2 + \frac{1}{6} y - 1 = \frac{y(2y+1)(y+1)}{6} - 1$

I put a formula in javascript to that effect, so I could know my cost for the vehicle when including all upgrades.

Here is a table showing the total price of each vehicle after including all upgrades.

## Stages

Besides vehicle costs, stages cost coins too. While playing stages, I earn game coins to pay for more stages, vehicles, and upgrades.

I found that each game has caches of coins (\$) at roughly 30 horizontal meters (m) apart. The cache is formed in coins of various denominations (5, 25, 100, 500). The cache has at most 14 coins, placed along the surface in two rows of seven. Therefore the maximum cache is 7,000 coins. Once such a cache is reached in a level, each cache thereafter is the same size. Additionally, the cache total amount is proportional to its distance into the level, but rounded to the nearest 5. Stated another way, the coin caches in a level step up by a fixed amount (Δ) each time. Though the first cache gives me this number within 5, I examined the coin cache at 300 meters to estimate the Δ to within unit precision.

Another way each stage pays out is by leveling up. Leveling up occurs when I reach some further distance in a stage. Leveling up corresponds to some payouts in linearly incremental rewards as well.

aSome caches seem to be skipped or re-positioned due to special characteristics of the terrain.

I have a formula to calculate coins collectable approximately in the two ways just described based upon reaching some variable meters into the stage.

Each level records the vehicle's best score.

## Tricks

Besides level-based payouts, I also get coins from doing tricks.

1. Hop = 0 coins in the first 1/2 second
2. Air Time = 25 coins in 1/5 seconds up to 100 coins (1.3 second)
3. Big Air Time = 100 coins in 1/5 seconds up to 500 coins (2.1 seconds)
4. Insane Air Time = 500 coins in 1/5 seconds up to forever
5. Flip = 1,000 coins
6. Back Flip = 1,000 coins
7. Neck Flip = 2,500 coins (1st flip or back flip after driver is down)

Total coins = 3,000