public static PickRules CreatePickRules(bool duplicatesAllowed, bool ordered, int quantity) { var pr = new PickRules(); pr.DuplicatesAllowed = duplicatesAllowed; pr.Ordered = ordered; pr.Quantity = quantity; return pr; }
/// <summary> /// Calculates minimum number of picks to match x numbers. /// Also works out average/chances of other combinations. /// </summary> /// <param name="pool"></param> /// <param name="pickRules"></param> /// <param name="matches"></param> /// <returns></returns> public static double RequiredPicksToWin(Pool pool, PickRules pickRules, int matches) { int n = pool.Numbers.Count(); int k = pickRules.Quantity; int b = matches; // (k/b)! * ((n-k)/(k-b)) // ¬¬¬¬¬¬¬¬ // (n - k)! var numerator = SpecialFunctions.Factorial(n); var denominator = SpecialFunctions.Factorial(n - k); result = numerator / denominator; throw new NotImplementedException(); }
/// <summary> /// Create all the possible selections for the pool and pick rules. /// </summary> /// <param name="pool"></param> /// <param name="pickRules"></param> /// <returns></returns> public static List<Selection> CreateAllSelections(Pool pool, PickRules pickRules) { // Validat the input if (pool == null) throw new ArgumentNullException("pool"); if (pickRules == null) throw new ArgumentNullException("pickRules"); // Get all possible combinations based on the pickRules var allSelections = new List<Selection>(); if (!pickRules.DuplicatesAllowed && !pickRules.Ordered) { allSelections = NoDuplicatesUnorderedSelections(pool, pickRules.Quantity); } //var completed = false; //while (!completed) //{ // var selection = new Selection(); // completed = true; //} return allSelections; }
/// <summary> /// Create a selection from the pool using the pick rules. /// </summary> /// <param name="pool"></param> /// <param name="pickRules"></param> /// <returns></returns> public static Selection CreateSelection(Pool pool, PickRules pickRules) { // Validat the input if (pool == null) throw new ArgumentNullException("pool"); if (pickRules == null) throw new ArgumentNullException("pickRules"); var selection = new Selection(); return selection; }
/// <summary> /// The chances of matching x balls for the given selections /// </summary> /// <param name="pool"></param> /// <param name="pickRules"></param> /// <param name="selections"></param> /// <returns></returns> public static double[] ChancesOfMatching(Pool pool, PickRules pickRules, IEnumerable<Selection> selections ) { throw new NotImplementedException(); }