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);
        }
    }
Exemple #2
0
 public override void Freshen()
 {
     if (curLevel != -1)
     {
         currentPool.Freshen();
     }
 }
    protected override bool ModifyInternal(RoomSpec spec, double scale)
    {
        _amounts.Freshen();
        _primitives.Freshen();
        byte amount             = _amounts.Get(spec.Random);
        List <BaseRoomMod> mods = _primitives.Get(spec.Random, amount);

        throw new NotImplementedException("");
        return(true);
    }
 public override void Freshen()
 {
     _pool.Freshen();
 }