Commits

Anonymous committed 623f2fb

better staistical info

Comments (0)

Files changed (1)

         res[check(roll(ndice))] += 1
     return normedsucc(res, min_succ)
 
+def low95(res):
+    l = len(res)
+    res.sort()
+    return mean(res[l//40:max(1, l*3//40)])
+
+def high95(res):
+    l = len(res)
+    res.sort()
+    return mean(res[-max(2,int(l*3//40)):-max(1,l//40)])
+
 def display(r):
     return "success: " + str(100*r[0]) + "%, botch: " + str(100*r[1]) + "%"
 
 if __name__ == "__main__":
     results = defaultdict(list)
-    # gather mutltiple times
+    # gather results mutltiple times
     print(numtests // rollsperplayer, "players")
     for num in range(numtests//rollsperplayer):
         for min_succ in range(1,5):
             for i in range(1,11):
                 results[(min_succ, i)].append(test(i, rollsperplayer, min_succ))
+
+    # process results
     keys = list(results.keys())
     keys.sort()
+    #: statistical infoline
+    statinfo = "(2,5-7,5%, mean, 92,5%-97,5% (~2std))"
     minsu = 1
-    print("=== min successes:", minsu, " (95% (2std)) ===")
+    print("=== min successes:", minsu, statinfo, "===")
     for i in keys:
         if i[0] != minsu:
             minsu = i[0]
-            print("\n=== min successes:", minsu, "(95% (2std))===")
+            print("\n=== min successes:", minsu, statinfo, "===")
         succ = [succ for succ,bot in results[i]]
+        botch = [bot for succ,bot in results[i]]
         succmean = 100*mean(succ)
-        succstd = 100*std(succ)
-        botch = [bot for succ,bot in results[i]]
+        #succstd = 100*std(succ)
         botchmean = 100*mean(botch)
-        botchstd = 100*std(botch)
-        succfrom = succmean - 2*succstd
-        succto = succmean + 2*succstd
-        botchfrom = botchmean - 2*botchstd
-        botchto = botchmean + 2*botchstd
-        print("dice", i[1], ": succ:", "{:4.2F}".format(succfrom), "-", "{:4.2F}".format(succto), end=" ")
-        print("-- botch:", "{:4.1F}".format(botchfrom), "-", "{:4.1F}".format(botchto))
+        #botchstd = 100*std(botch)
+        succfrom = 100*low95(succ)
+        succto = 100*high95(succ)
+        botchfrom = 100*low95(botch)
+        botchto = 100*high95(botch)
+        print("dice", i[1], ": succ:", "{:4.2F}".format(succfrom), ",", "{:4.2F}".format(succmean), ",", "{:4.2F}".format(succto), end=" ")
+        print("-- botch:", "{:4.1F}".format(botchfrom), ",", "{:4.1F}".format(botchmean), ",", "{:4.1F}".format(botchto))