示例#1
0
        private void AutoTest_Click(object sender, EventArgs e)
        {
            try
            {
                bool SwapLogging = LoggingState;


                int CycleLength = Convert.ToInt32(CycleL.Text);
                int RunCount    = Convert.ToInt32(RunC.Text);
                Count.Text = "" + CycleLength;
                for (int i = 0; i < RunCount; i++)
                {
                    if (SwapLogging)
                    {
                        ToggleLogButton();
                    }
                    LearningButton();
                    AiVAiButton();
                    StartButton();
                    PlayingButton();
                    BaseLineButton();
                    BaseLineStartButton();
                    if (SwapLogging)
                    {
                        ToggleLogButton();
                    }

                    int[][] temp = CC.GetBaseLineArray(LoggingState);
                    for (int j = 0; j < temp.Length; j++)
                    {
                        if (j != temp.Length - 1)
                        {
                            LogBox.AppendText(temp[j][0] + ", " + temp[j][1] + ", " + temp[j][2] + "  |  ");
                        }
                        else
                        {
                            LogBox.AppendText(temp[j][0] + ", " + temp[j][1] + ", " + temp[j][2]);
                        }
                    }
                    LogBox.AppendText(Environment.NewLine);
                }
            }
            catch (FormatException)
            {
                OtherLogBox.AppendText("Invalid input" + Environment.NewLine);
            }
        }
示例#2
0
 private void SimSetup_Click(object sender, EventArgs e)
 {
     if (!Running)
     {
         try
         {
             CurrentSim  = TicTacToeSim;
             SimulatorID = 1;
             int CombinationLevel = Convert.ToInt32(CombLevel.Text);
             if (CombinationLevel > 0 && CombinationLevel < 10)
             {
                 SimSetupButton(CombinationLevel, CurrentSim);
             }
         }
         catch (FormatException)
         {
             OtherLogBox.AppendText("Invalid input" + Environment.NewLine);
         }
     }
     else
     {
         OtherLogBox.AppendText("Cannot change Simulator while running" + Environment.NewLine);
     }
 }
示例#3
0
        private void StartButton()
        {
            // 0 = Human vs Human
            // 1 = Human vs Ai
            // 2 = Ai vs Ai
            // 3 = Ai vs Baseline
            // 4 = Ai vs Random
            Running = true;
            if (PlayerMode == 2)
            {
                try
                {
                    int       temp = Convert.ToInt32(Count.Text);
                    Stopwatch sw   = new Stopwatch();
                    sw.Start();
                    for (int i = 1; i <= temp; i++)
                    {
                        CC.StartRound(CurrentSim);
                        LearningPlayingMode();
                        if (SimulatorID == 1)
                        {
                            SetupBoard();
                        }
                        else if (SimulatorID == 2)
                        {
                            UltTTT.SetupBoard();
                        }

                        if (i % 50 == 0)
                        {
                            OtherLogBox.AppendText(i + Environment.NewLine);
                        }
                    }
                    sw.Stop();
                    Running = false;
                    OtherLogBox.AppendText(sw.ElapsedMilliseconds + Environment.NewLine);
                }
                catch (FormatException)
                {
                    OtherLogBox.AppendText("Invalid input" + Environment.NewLine);
                    Running = false;
                }
            }
            else if (PlayerMode == 4)
            {
                try
                {
                    CC.AiVRandom(CurrentSim, Convert.ToInt32(Count.Text));
                    Running = false;
                }
                catch (FormatException)
                {
                    OtherLogBox.AppendText("Invalid input" + Environment.NewLine);
                    Running = false;
                }
            }
            else if (PlayerMode == 3)
            {
                CC.BaseLineTest(CurrentSim);
                string[] temp = CC.GetBaseLineResults();
                for (int i = 0; i < temp.Length; i++)
                {
                    if (SimulatorID == 1)
                    {
                        LogBox.AppendText(temp[i] + Environment.NewLine);
                    }
                    else if (SimulatorID == 2)
                    {
                        UltTTT.LogInformation(temp[i]);
                    }
                }
                Running = false;
            }
            else
            {
                if (SimulatorID == 1)
                {
                    SetupBoard();
                }
                else if (SimulatorID == 2)
                {
                    UltTTT.SetupBoard();
                }
            }
        }
示例#4
0
 private void LogIt(NodeCluster m, string e)
 {
     OtherLogBox.AppendText(e);
     OtherLogBox.AppendText(Environment.NewLine);
 }
示例#5
0
 private void LogIt(CommunicationCenter m, string e)
 {
     OtherLogBox.AppendText(e);
     OtherLogBox.AppendText(Environment.NewLine);
 }