ソースを参照

Lower precision when handling Description scores.

Reddo 5 年 前
コミット
341e8b6e52
1 ファイル変更5 行追加2 行削除
  1. 5 2
      app/World/Classes/ContentPicker/ContentDescription.ts

+ 5 - 2
app/World/Classes/ContentPicker/ContentDescription.ts

@@ -43,8 +43,11 @@ class ContentDescription {
         // After shuffling the list, descriptions with the highest scores go at the top, and between those the ones with the lowest saidCounts go first
         // If multiple descriptions have the same score/saidCount, they are picked randomly due to the previous shuffling.
         a.sort((a : ContentDescription, b : ContentDescription) => {
-            let scoreA = a.getScore() / (a.saidCount + 1);
-            let scoreB = b.getScore() / (b.saidCount + 1); // By dividing the score gby the amount of times it was said we increase rotation of descriptions
+            // Division by saidCount for now, to increase rotativity of descriptions
+            // Reduce precision on final number to decrease the likelihood of printing the same descriptions always in the same order
+            let precision = 5;
+            let scoreA = Math.floor(precision * a.getScore() / (a.saidCount + 1)) / precision;
+            let scoreB = Math.floor(precision * b.getScore() / (b.saidCount + 1)) / precision;
             if (scoreA != scoreB) return scoreB - scoreA;
             return 0;
         });