/// <summary>
        /// Check if Stack() will return a solution for the current permutation
        /// </summary>
        /// <param name="value"></param>
        private static void CheckPermutation(int[] value)
        {
            var newPerm = new char[value.Length];

            for (int i = 0; i < value.Length; i++)
            {
                newPerm.SetValue(InputSet.GetValue(value[i] - 1), i);
            }
            var stacks = Stack(newPerm, numBoxes);

            if (CheckSums(stacks))
            {
                Console.WriteLine("Found a solution!");
                foundSolution = true;
                foreach (var c in stacks)
                {
                    foreach (var v in c)
                    {
                        Console.Write(v);
                    }
                    Console.WriteLine();
                }
                ;
            }
            PermutationCount++;
        }
Exemple #2
0
 private void OutputPermutation(int[] value)
 {
     foreach (int i in value)
     {
         Console.Write(InputSet.GetValue(i - 1));
     }
     Console.WriteLine();
     PermutationCount++;
 }
        private static void OutputPermutation(int[] value)
        {
            var newPerm = new char[value.Length];

            for (int i = 0; i < value.Length; i++)
            {
                newPerm.SetValue(InputSet.GetValue(value[i] - 1), i);
            }
            permutations.Add(newPerm);
            PermutationCount++;
        }