public Possibility AddPossibility(Possibility pos) { if (pos.Weight > 0) { pos.Offset = TotalWeight;//offset at end of last choice TotalWeight += pos.Weight; possibilities.Add(pos); } return(pos); }
public static bool SingleChoice(Possibility pos) { float val = (float)(GenericsClass.Random.NextDouble() * 1); return(val < pos.Weight); }
public Possibility AddPossibility(float weight, string name) { Possibility pos = new Possibility(weight, name); return(AddPossibility(pos)); }
public Choice(Possibility pos) : base() { AddPossibility(pos); }