Permalink
Browse files

Add absolute tolerance for stats

  • Loading branch information...
jkelin committed Jun 17, 2018
1 parent 0fc59aa commit 04c6d01535db37055e4a082ac2729deb82dc8c6f
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/anticheat.ts
View
@@ -46,8 +46,10 @@ export function isValid(player: IUploadedPlayer, data: IUploadedData) {
const preprocessed = isValidPreprocess(player, data);
const stats: Dictionary<{max: number, avg: number, median: number, p90: number, p95: number, p99: number}> = require('./anticheat-stats.json');
const absoluteTolerance = data.players.length * 5;
const difference = _(preprocessed)
.mapValues((value, key) => Math.max(0, value - stats[key].p99)) // absolute differences
.mapValues((value, key) => Math.max(0, value - (stats[key].p99 + absoluteTolerance))) // absolute differences
.mapValues((diff, key) => diff / stats[key].p99) // percentage differences
.values() // percentages
.sum();

0 comments on commit 04c6d01

Please sign in to comment.