public void SetupBoard() { PointerX = 0; PointerO = 0; CurrentBoard = -1; TurnID = 0; SelectFlag.Text = "Choose a board"; UltSim.Start(); BoardBox.Invalidate(); if (PlayerMode == 2) { CC.StartRound(0, 1); CC.StartRound(1, 2); int Temporary = 0; while (Temporary < 150) { if (!MUI.CurrentSim.Finished()) { MUI.AiMove(); } else { break; } Temporary++; } } }
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(); } } }