/// <summary> /// Randomly selects an edge and corner permutation based on the probabilities of the combination leaves, and the probabilities of the permutations in the nodes /// </summary> /// <param name="combinationNode">A node specifying the combinations of numbers of algorithms for edges and corners</param> /// <param name="edgeNodes">All edge permutations and their relative probabilities</param> /// <param name="cornerNodes">All corner permutations and their relative probabilities</param> /// <param name="random"></param> /// <returns></returns> public static Tuple <FinalLeaf, FinalLeaf> SelectPermutation(this CombinationNode combinationNode, List <Node> edgeNodes, List <Node> cornerNodes, Random random) { var combinationLeaf = combinationNode.Leaves.SelectRandom(x => x.Probability, random); var edgeNode = edgeNodes.Single(x => x.NumAlgs == combinationLeaf.EdgeAlgs); var cornerNode = cornerNodes.Single(x => x.NumAlgs == combinationLeaf.CornerAlgs); return(SelectPermuataion(edgeNode, cornerNode, random)); }
/// <summary> /// Gets a scramble sequence based on the number of algorithms specified. /// </summary> /// <param name="edgeNodes">All possible edge permutations and their probabilites</param> /// <param name="cornerNodes">All possible corner permutations and their probabilites</param> /// <param name="combinationNode">A set of possibilities of numbers of egde and corner algorithms.</param> /// <param name="rand"></param> /// <returns></returns> public static string GetScramble(List <Node> edgeNodes, List <Node> cornerNodes, CombinationNode combinationNode, Random rand) { var leaves = combinationNode.SelectPermutation(edgeNodes, cornerNodes, rand); return(GetScrambleFromLeaves(leaves.Item1, leaves.Item2, rand)); }