From 52b201ff87ecd663cb136e682a966d49aa4f8747 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sun, 23 May 2021 21:43:23 -0400 Subject: [PATCH] Change to vary boost by votes --- src/routes/getSkipSegments.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/routes/getSkipSegments.ts b/src/routes/getSkipSegments.ts index 5e15b1a..04600dd 100644 --- a/src/routes/getSkipSegments.ts +++ b/src/routes/getSkipSegments.ts @@ -169,9 +169,11 @@ function getWeightedRandomChoice(choices: T[], amountOf //assign a weight to each choice let totalWeight = 0; let choicesWithWeights: TWithWeight[] = choices.map(choice => { + const boost = Math.min(choice.reputation, Math.max(0, choice.votes * 2)); + //The 3 makes -2 the minimum votes before being ignored completely //this can be changed if this system increases in popularity. - const weight = Math.exp((choice.votes + 3 + choice.reputation)); + const weight = Math.exp(choice.votes * Math.min(1, choice.reputation + 1) + 3 + boost); totalWeight += weight; return {...choice, weight};