better falling costs

This commit is contained in:
Leijurv
2018-08-04 18:28:36 -04:00
parent 84d9a9bf35
commit d3a2238493
5 changed files with 309 additions and 19 deletions

View File

@@ -0,0 +1,19 @@
package baritone.bot.pathing.movement;
import org.junit.Test;
import static baritone.bot.pathing.movement.ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.FALL_N_BLOCKS_COST;
import static org.junit.Assert.assertEquals;
public class ActionCostsButOnlyTheOnesThatMakeMickeyDieInsideTest {
@Test
public void testFallNBlocksCost() {
assertEquals(FALL_N_BLOCKS_COST.length, 257); // Fall 0 blocks through fall 256 blocks
for (int i = 0; i < 256; i++) {
double t = FALL_N_BLOCKS_COST[i];
double fallDistance = 3.92 * (99 - 49.50 * (Math.pow(0.98, t) + 1) - t);
assertEquals(fallDistance, -i, 0.000000000001); // If you add another 0 the test fails at i=43 LOL
}
}
}