Exemple #1
0
        public KaprekarRoutine(int digitLength, int baseNumber)
        {
            this.digitLength = digitLength;
            this.baseNumber  = baseNumber;

            number           = new Number(digitLength, baseNumber);
            descendingNumber = new Number(digitLength, baseNumber);
            ascendingNumber  = new Number(digitLength, baseNumber);

            routineSequence = new RoutineSequence();
            solutions       = new HashSet <string>();
        }
Exemple #2
0
        public RoutineSequence GetSolution(Number number)
        {
            var  solution = new RoutineSequence();
            bool add      = false;

            foreach (var item in sequence)
            {
                if (item == number)
                {
                    add = true;
                }
                if (add)
                {
                    solution.Add(item);
                }
            }

            return(solution);
        }