mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-11 02:03:58 +01:00
Fixed off-by-one error in the fast calculateCost function
The off-by-one error was in the original sum, so it's not obvious in the simplified version of the sum. Fixing this greatly improved the accuracy of the simple calculation for small counts, but I'm leaving the recursive mode in. Maybe I'll lower the threshold, though. 100 isn't a terribly small number.
This commit is contained in:
parent
8d9e077b66
commit
8b026f606b
@ -148,7 +148,7 @@ export class Skill {
|
||||
//unFloored is roughly equivalent to
|
||||
//(this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost
|
||||
//being repeated for increasing currentLevel
|
||||
const preMult = (count + 1) * ((2 * this.baseCost) + this.costInc * (2 * currentLevel + count)) / 2;
|
||||
const preMult = count * ((2 * this.baseCost) + this.costInc * (2 * currentLevel + count + 1)) / 2;
|
||||
const unFloored = (preMult * BitNodeMultipliers.BladeburnerSkillCost) - count / 2;
|
||||
return Math.floor(unFloored);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user