Esempio n. 1
0
        /// <summary>
        ///  the computers play
        /// </summary>
        private void ComputerPlay()
        {
            DisableAllButtons();
            uxTextBox.Text = "My Turn.";
            Update();

            for (int i = 0; i < 25000; i++)
            {
                UltimateBoard temp = new UltimateBoard(_currentGamePosition);
                _portionOfGameTree.Simulate(temp);
            }

            GameTreeNode t = _portionOfGameTree.GetBestChild();

            (int, int, int, int)p = t.Play;
            _currentGamePosition.Play(p);
            uxFlowLayoutPanel.Controls[p.Item1].Controls[p.Item2].Controls[p.Item3].Controls[p.Item4].Text = _SymbolOComputer;

            if (!GameIsover("I"))
            {
                _portionOfGameTree = t;

                foreach ((int, int, int, int)loc in _currentGamePosition.GetAvailablePlays())
                {
                    uxFlowLayoutPanel.Controls[loc.Item1].Controls[loc.Item2].Controls[loc.Item3].Controls[loc.Item4].Enabled = true;
                }
                uxTextBox.Text = "Your Turn.";
            }
        }