Example #1
0
        /// <summary>
        /// Runs the main logic of the activity. Has access to the context,
        /// which holds the values of properties for this activity and those from the parent scope.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        ///


        protected override Task ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            rowBegin    = FirstY.Get(context) + 1;
            rowFinal    = LastY.Get(context) + 1;
            columnBegin = FirstX.Get(context) + 1;
            columnFinal = LastX.Get(context) + 1;
            return(base.ExecuteAsync(context, cancellationToken));
        }
Example #2
0
        public bool Step()
        {
            //Formula :                             y = y + Ps(2*Pe(y) - y) - Pe(y)
            bool     step = false;
            FourCube FirstY;                        //instance of the Y

            FirstY = this.fourCube;                 //init with newspaper Sudoku
            FourCube SecondY;                       //instance of the Y'
            FourCube temp, Ps;
            UInt16   loop = 0;

            while (step != true)
            {
                //Array.Clear(arrayAnswer, 0, arrayAnswer.Length);

                SecondY = FirstY.Equalizer();        // Pe(y)
                SecondY = SecondY.mult(2);           // 2*Pe(y)
                SecondY = FirstY.Subtract(SecondY);  // 2*Pe(y) - y
                SecondY = SecondY.Selector();        // Ps(2*Pe(y) - y)
                // arrayAnswer = SecondY.returnArray();
                Ps      = SecondY;
                temp    = FirstY.Equalizer();        // Pe(y)
                SecondY = temp.Subtract(SecondY);    // Ps(2*Pe(y) - y) - Pe(y)
                SecondY = FirstY.Add(SecondY);       // Ps(2*Pe(y) - y) - Pe(y) + y
                step    = SecondY.Comparator(Ps, temp);
                if (!step)
                {
                    diff = SecondY.Difference(SecondY, FirstY);
                    diffList.Add(diff);
                    FirstY = SecondY;
                }
                else
                {
                    diff = SecondY.Difference(SecondY, FirstY);
                    diffList.Add(diff);
                    arrayAnswer = SecondY.SudokuAnswer(temp);
                }
                loop += 1;
            }
            return(step);
        }