public void NodeCreation(int Index, int CombinationLevel, Thread t)
 {
     if (Index == -1)
     {
         BaseL.GetArrays();
         BaseL.MakeNodeClusterGetArrays();
         if (RecalculateFlag)
         {
             BaseL.GenerateNodes(CombinationLevel);
         }
         else
         {
             BaseL.GenerateNodes(UntrimmedCombinations);
         }
         BaseL.SetPlayMode(PlayMode);
         BaseL.SetPlayerMode(PlayerMode);
         t.Abort();
     }
     else if (Index >= 0)
     {
         CC[Index].GetArrays();
         CC[Index].MakeNodeClusterGetArrays();
         if (RecalculateFlag)
         {
             CC[Index].GenerateNodes(CombinationLevel);
         }
         else
         {
             CC[Index].GenerateNodes(UntrimmedCombinations);
         }
         CC[Index].SetPlayMode(PlayMode);
         CC[Index].SetPlayerMode(PlayerMode);
         t.Abort();
     }
 }
        // Simulation Tester Methods
        public void InternalSimulatorSetup(bool LoggingState, InternalSimulator TestSimulator)
        {
            IDT.setStringArgs(TestSimulator.GetCommandNames());
            CC = new CommandCenter[TestSimulator.GetPlayerCount()];
            //int ThreadCount = Environment.ProcessorCount * 2;
            //int currentProcessor = 0;
            Thread[] GenerationThreads = new Thread[CC.Length + 1];
            int      CombinationLevel  = (int)IDT.getItem(3, 0, 0);

            for (int i = 0; i < CC.Length; i++)
            {
                CC[i] = new CommandCenter(IDT, "" + CommandCenterCount, LoggingState, this);
                CommandCenterCount++;
                SubCC(CC[i]);
            }
            BaseL = new CommandCenter(IDT, "" + BaseLineCCCount, "Baseline", LoggingState, this);
            BaseLineCCCount++;
            SubCC(BaseL);

            int[][] CommandSig = TestSimulator.GetCommandSignature();
            IDT.setIntArgs(CommandSig);
            RandomInput = new Randomizer((int)IDT.getItem(3, 0, 0));
            for (int i = 0; i < CC.Length; i++)
            {
                CC[i].GetArrays();
                CC[i].SetBounds(TestSimulator.ReturnRecommendedRange());
                CC[i].CreateClustersFromTemplate1();
            }
            BaseL.GetArrays();
            BaseL.SetBounds(TestSimulator.ReturnRecommendedRange());
            BaseL.CreateClustersFromTemplate1();
            int[][] DataSig = new int[1][];
            DataSig[0] = TestSimulator.GetDataSignature();
            IDT.setIntArgs(DataSig);
            string[] Names = IDT.getStringArgs()[0];
            for (int i = 0; i < CC.Length; i++)
            {
                CC[i].SetClusterNames(Names);
            }

            for (int i = -1; i < CC.Length; i++)
            {
                int temp = i;
                GenerationThreads[temp + 1] = new Thread(() => NodeCreation(temp, CombinationLevel, GenerationThreads[temp + 1]));
                GenerationThreads[temp + 1].Start();
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();
            UILog(this, CC.ToString());
        }