Example #1
0
        public void InternalLearning()
        {
            double temp   = ((int)Round1[Round1.Count - 1]); // The score from that round
            double Weight = temp / 100;

            if (temp > 0) // Means it won | Temporary change, fix this | it should be (temp > 0)
            {
                IDT.SetState(false);
                for (int i = 0; i < (Round1.Count - 1) / 3; i++)
                {
                    ((NodeCluster)Round1[i * 3]).SetLearning(true);
                    IDT.setObjectArgs((object[])Round1[(i * 3) + 2]);
                    IDT.SetState(true);
                    ((NodeCluster)Round1[i * 3]).GetAllData();
                    ((NodeCluster)Round1[i * 3]).StepTowardsTrue((BitArray)Round1[(i * 3) + 1], (Weight * (i + 1)));
                    IDT.SetState(false);
                }
            }
            else if (temp < 0) // Means it lost | Also fix this one (temp < 0)
            {
                IDT.SetState(false);
                for (int i = 0; i < (Round1.Count - 1) / 3; i++)
                {
                    ((NodeCluster)Round1[i * 3]).SetLearning(true);
                    IDT.setObjectArgs((object[])Round1[(i * 3) + 2]);
                    IDT.SetState(true);
                    ((NodeCluster)Round1[i * 3]).GetAllData();
                    ((NodeCluster)Round1[i * 3]).StepTowardsFalse((BitArray)Round1[(i * 3) + 1], (Weight * -(i + 1)));
                    IDT.SetState(false);
                }
            }
            else // Means it tied
            {
                IDT.SetState(false);
                for (int i = 0; i < (Round1.Count - 1) / 3; i++)
                {
                    ((NodeCluster)Round1[i * 3]).SetLearning(true);
                    IDT.setObjectArgs((object[])Round1[(i * 3) + 2]);
                    IDT.SetState(true);
                    ((NodeCluster)Round1[i * 3]).GetAllData();
                    ((NodeCluster)Round1[i * 3]).StepOpposite((BitArray)Round1[(i * 3) + 1], (1 * (i + 1)));
                    IDT.SetState(false);
                }
            }
            IDT.SetState(false);
        }
 public void SingleCCTurn(InternalSimulator TestSim, int cc, int Player)
 {
     if (cc == -1)
     {
         while (TestSim.Turn() == Player && !TestSim.Finished())
         {
             IDT.setObjectArgs(TestSim.GetData(Player));
             IDT.SetState(true);
             BaseL.GetArrays();
             BaseL.ForceNodeClustersToGetData();
             BaseL.NodeCalculations();
             TestSim.SetCommand(BaseL.GetAllDecisions());
             IDT.SetState(false);
             currentCommandNumber = TestSim.ReturnChosenCommand();
             CCLog(this, new CommandCArgs(new int[] { currentCommandNumber, Player }));
         }
     }
     else
     {
         while (TestSim.Turn() == Player && !TestSim.Finished())
         {
         }
         IDT.setObjectArgs(TestSim.GetData(Player));
         IDT.SetState(true);
         CC[cc].GetArrays();
         CC[cc].ForceNodeClustersToGetData();
         CC[cc].NodeCalculations();
         TestSim.SetCommand(CC[cc].GetAllDecisions());
         IDT.SetState(false);
         currentCommandNumber = TestSim.ReturnChosenCommand();
         CCLog(this, new CommandCArgs(new int[] { currentCommandNumber, Player }));
         if (PlayMode == 0)
         {
             CC[cc].LogCluster(currentCommandNumber);
         }
     }
 }