Пример #1
0
        /// <summary>
        /// Initialisation constructor
        /// </summary>
        /// <param name="pList">List of pancakes</param>
        public Solution(List <Pancake> pList, Alhorythms soursAlhorythm)
            : base(pList)
        {
            //Finde the result
            Result = findeResult();

            //Identifi how solution was created
            SoursAlhorythm = soursAlhorythm;
        }
Пример #2
0
        /// <summary>
        /// Creator of solution
        /// </summary>
        /// <param name="numbers">Numbers of pancakes we need</param>
        /// <param name="pList">List of all pancake</param>
        /// <param name="usedAlhorythm">Alhorithm used to get solution</param>
        /// <returns>Solution</returns>
        static Solution SolutionConstructor(int[] numbers, List <Pancake> pList, Alhorythms usedAlhorythm)
        {
            //Difine list of needable pancakes
            List <Pancake> resultList = new List <Pancake>();

            //Finde nidable pancakes
            for (int i = 0; i < numbers.Length; i++)
            {
                resultList.Add(pList[numbers[i]]);
            }

            //Sort the pancakes
            resultList.Sort(new Comparison <Pancake>(RadiusCompear));

            //Form solution
            Solution result = new Solution(resultList, usedAlhorythm);

            return(result);
        }