Improve leech criterion
John Smith

John Smith commited on 2023-151 10:01:58
Showing 1 changed files, with 2 additions and 2 deletions.


The `badness` function already in `src/leeches.lua` is now used
to determine whether a prompt is a leech, not just to sort the list
of leeches, and now uses a slightly different formula.
... ...
@@ -2,14 +2,14 @@
2 2
     return number indicating how much of a leech the prompt is
3 3
 ]]
4 4
 local function badness(pr)
5
-    return pr.fail / (pr.fail + pr.succ) * math.log(pr.fail)
5
+    return math.log(pr.fail) / pr.succ * (pr.fail + pr.succ) / math.log(pr.delay)
6 6
 end
7 7
 
8 8
 local function fn(config, deck)
9 9
     local leechqueue = {}
10 10
     for i, cg in ipairs(deck) do
11 11
         for j, pr in ipairs(cg) do
12
-            if pr.ease < 2 and pr.delay >= 0 then
12
+            if badness(pr) > 0.3 and pr.delay >= 0 then
13 13
                 table.insert(leechqueue, { i, j })
14 14
             end
15 15
         end
16 16