prettify, sorry for the big ass commit

This commit is contained in:
Olivier Gagnon
2021-09-04 19:09:30 -04:00
parent 3d7cdb4ef9
commit a18bdd6afc
554 changed files with 91615 additions and 66138 deletions
+2 -2
View File
@@ -2,5 +2,5 @@ import { CONSTANTS } from "../../Constants";
import { IPlayer } from "../../PersonObjects/IPlayer";
export function repFromDonation(amt: number, player: IPlayer): number {
return amt / CONSTANTS.DonateMoneyToRepDivisor * player.faction_rep_mult;
}
return (amt / CONSTANTS.DonateMoneyToRepDivisor) * player.faction_rep_mult;
}
+7 -7
View File
@@ -6,14 +6,14 @@
// Then we use https://herbie.uwplse.org/demo/ to simplify it and prevent
// Infinity issues.
export function favorToRep(f: number): number {
function fma(a: number, b: number, c: number): number {
return a * b + c;
}
const ex = fma(f, (Math.log(51.0) - Math.log(50.0)), Math.log(51.0));
return fma(500.0, Math.exp(ex), -25000.0);
function fma(a: number, b: number, c: number): number {
return a * b + c;
}
const ex = fma(f, Math.log(51.0) - Math.log(50.0), Math.log(51.0));
return fma(500.0, Math.exp(ex), -25000.0);
}
// Wolfram Alpha: 500 (50^(-n) 51^(n + 1) - 50) solve for n
export function repToFavor(r: number): number {
return -(Math.log(25500/(r + 25000)))/Math.log(51/50);
}
return -Math.log(25500 / (r + 25000)) / Math.log(51 / 50);
}