Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Selling point for pure essence in Element Tower Defence (StarCraft 2 version)
<?php
$maxWave = 60;
$interestInterval = 15;
$interestPercentage = 2;
$waveDuration = 40;
$lateSell = getSaleProfit( $maxWave );
for ( $sellWave = 1; $sellWave <= $maxWave; $sellWave++ ) {
$numberOfExtraInterests = ( $maxWave - $sellWave ) * $waveDuration / $interestInterval;
$earlySell = getSaleProfit( $sellWave ) * pow( 1 + $interestPercentage / 100, $numberOfExtraInterests );
echo sprintf(
"On wave %d early sell is %d, which is %d better than %d for late sell\n",
$sellWave,
$earlySell,
$earlySell - $lateSell,
$lateSell
);
}
function getSaleProfit( $waveNumber ) {
return pow( $waveNumber, 2 ) * 2.5;
}
/*
On wave 1 early sell is 56, which is -8943 better than 9000 for late sell
On wave 2 early sell is 213, which is -8786 better than 9000 for late sell
On wave 3 early sell is 456, which is -8543 better than 9000 for late sell
On wave 4 early sell is 769, which is -8230 better than 9000 for late sell
On wave 5 early sell is 1140, which is -7859 better than 9000 for late sell
On wave 6 early sell is 1558, which is -7441 better than 9000 for late sell
On wave 7 early sell is 2011, which is -6988 better than 9000 for late sell
On wave 8 early sell is 2492, which is -6507 better than 9000 for late sell
On wave 9 early sell is 2992, which is -6007 better than 9000 for late sell
On wave 10 early sell is 3504, which is -5495 better than 9000 for late sell
On wave 11 early sell is 4022, which is -4977 better than 9000 for late sell
On wave 12 early sell is 4540, which is -4459 better than 9000 for late sell
On wave 13 early sell is 5054, which is -3945 better than 9000 for late sell
On wave 14 early sell is 5560, which is -3439 better than 9000 for late sell
On wave 15 early sell is 6055, which is -2944 better than 9000 for late sell
On wave 16 early sell is 6535, which is -2464 better than 9000 for late sell
On wave 17 early sell is 6998, which is -2001 better than 9000 for late sell
On wave 18 early sell is 7442, which is -1557 better than 9000 for late sell
On wave 19 early sell is 7865, which is -1134 better than 9000 for late sell
On wave 20 early sell is 8267, which is -732 better than 9000 for late sell
On wave 21 early sell is 8645, which is -354 better than 9000 for late sell
On wave 22 early sell is 9000, which is 0 better than 9000 for late sell
On wave 23 early sell is 9331, which is 331 better than 9000 for late sell
On wave 24 early sell is 9637, which is 637 better than 9000 for late sell
On wave 25 early sell is 9919, which is 919 better than 9000 for late sell
On wave 26 early sell is 10177, which is 1177 better than 9000 for late sell
On wave 27 early sell is 10410, which is 1410 better than 9000 for late sell
On wave 28 early sell is 10620, which is 1620 better than 9000 for late sell
On wave 29 early sell is 10806, which is 1806 better than 9000 for late sell
On wave 30 early sell is 10969, which is 1969 better than 9000 for late sell
On wave 31 early sell is 11110, which is 2110 better than 9000 for late sell
On wave 32 early sell is 11230, which is 2230 better than 9000 for late sell
On wave 33 early sell is 11328, which is 2328 better than 9000 for late sell
On wave 34 early sell is 11407, which is 2407 better than 9000 for late sell
On wave 35 early sell is 11466, which is 2466 better than 9000 for late sell
On wave 36 early sell is 11506, which is 2506 better than 9000 for late sell
On wave 37 early sell is 11529, which is 2529 better than 9000 for late sell
On wave 38 early sell is 11535, which is 2535 better than 9000 for late sell << best wave
On wave 39 early sell is 11526, which is 2526 better than 9000 for late sell
On wave 40 early sell is 11501, which is 2501 better than 9000 for late sell
On wave 41 early sell is 11461, which is 2461 better than 9000 for late sell
On wave 42 early sell is 11408, which is 2408 better than 9000 for late sell
On wave 43 early sell is 11343, which is 2343 better than 9000 for late sell
On wave 44 early sell is 11266, which is 2266 better than 9000 for late sell
On wave 45 early sell is 11178, which is 2178 better than 9000 for late sell
On wave 46 early sell is 11079, which is 2079 better than 9000 for late sell
On wave 47 early sell is 10971, which is 1971 better than 9000 for late sell
On wave 48 early sell is 10854, which is 1854 better than 9000 for late sell
On wave 49 early sell is 10730, which is 1730 better than 9000 for late sell
On wave 50 early sell is 10597, which is 1597 better than 9000 for late sell
On wave 51 early sell is 10458, which is 1458 better than 9000 for late sell
On wave 52 early sell is 10313, which is 1313 better than 9000 for late sell
On wave 53 early sell is 10163, which is 1163 better than 9000 for late sell
On wave 54 early sell is 10007, which is 1007 better than 9000 for late sell
On wave 55 early sell is 9847, which is 847 better than 9000 for late sell
On wave 56 early sell is 9683, which is 683 better than 9000 for late sell
On wave 57 early sell is 9516, which is 516 better than 9000 for late sell
On wave 58 early sell is 9346, which is 346 better than 9000 for late sell
On wave 59 early sell is 9174, which is 174 better than 9000 for late sell
On wave 60 early sell is 9000, which is 0 better than 9000 for late sell
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.