public void Test <T>(ProbabilityPool <T> pool, int max, bool print)
    {
        System.Random random = new System.Random();
        pool.Freshen();
        Dictionary <T, int> dict = new Dictionary <T, int>();

        for (int i = 0; i < max; i++)
        {
            T   c = pool.Get(random);
            int num;
            if (!dict.TryGetValue(c, out num))
            {
                num = 0;
            }
            num++;
            if (print)
            {
                BigBoss.Debug.w(Logs.Main, "Picked " + num + " " + c);
            }
            dict[c] = num;
        }

        pool.ToLog(Logs.Main);

        BigBoss.Debug.w(Logs.Main, "Real probability out of " + max);
        foreach (KeyValuePair <T, int> pair in dict)
        {
            BigBoss.Debug.w(Logs.Main, "  " + pair.Key + ": " + ((double)pair.Value / max * 100d) + " - " + pair.Value);
        }
    }
Beispiel #2
0
 public override void ToLog(Logs log, string name = "")
 {
     if (BigBoss.Debug.logging(log))
     {
         BigBoss.Debug.printHeader(log, "LeveledPool");
         BigBoss.Debug.w(log, "Item - Level - Multiplier - Unique");
         foreach (ProbContainer cont in prototypePool)
         {
             BigBoss.Debug.w(log, cont.Item + " - " + cont.Level + " - " + cont.Multiplier + " - " + cont.Unique);
         }
         if (curLevel != -1)
         {
             BigBoss.Debug.w(log, "Current level is " + curLevel);
             currentPool.ToLog(log, name);
         }
         BigBoss.Debug.printFooter(log, "LeveledPool");
     }
 }
 public override void ToLog(Logs log, string name = "")
 {
     _pool.ToLog(log, name);
 }