Пример #1
0
        public void Solve()
        {
            AllSolutions = new C.ConcurrentBag <LLint>();

            List <T.Task> allTasks = new List <T.Task>();

            foreach (var start in AllEdges(Starts))
            {
                if (AllSolutions.Count() < MaxCountSolutions)
                {
                    var Ta = new T.Task(
                        (edgeAndStartObject) =>
                    {
                        var edgeAndStart = (Tuple <LLint, LLint>)edgeAndStartObject;
                        Backtracking(edgeAndStart.Item1, edgeAndStart.Item2);
                    }, new Tuple <LLint, LLint>(Fn.Clone(AllEdges(Horizontals.Concat(Verticals.Concat(Diagonals))).Where(e => !Fn.Equal(e, start))), Fn.L(start)));

                    allTasks.Add(Ta);
                    Ta.Start();
                }
            }

            T.Task.WaitAll(allTasks.ToArray());

#if DEBUG
            DebugViewResult();
#endif
        }
Пример #2
0
        public void SolveSerial()
        {
            AllSolutions = new C.ConcurrentBag <LLint>();
            foreach (var start in AllEdges(Starts))
            {
                Backtracking(AllEdges(Horizontals.Concat(Verticals.Concat(Diagonals))).Where(e => !Fn.Equal(e, start)), Fn.L(start));
            }

#if DEBUG
            DebugViewResult();
#endif
        }