Beispiel #1
0
        public void TestBAddChildren()
        {
            UltimateBoard b = Games.GetBoard(Games.XWins, 43);
            GameTreeNode  t = new GameTreeNode(Games.XWins[42]);

            t.AddChildren(b);
            List <(int, int, int, int)> avail    = b.GetAvailablePlays();
            List <(int, int, int, int)> children = new List <(int, int, int, int)>();

            foreach ((int, int, int, int)play in avail)
            {
                children.Add(t.GetChild(play).Play); // Get the specified child and retrieve its play
            }
            Assert.That(children, Is.EquivalentTo(avail));
        }
Beispiel #2
0
        /// <summary>
        /// loads the board using a message box
        /// </summary>
        /// <param name="sender">object being held</param>
        /// <param name="e">event handle for the click event</param>
        private void UserInterface_Load(object sender, EventArgs e)
        {
            if (MessageBox.Show("Would you like to play first? ", "First Play", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                _SymbolPlayer    = "X";
                _SymbolOComputer = "O";

                _portionOfGameTree.AddChildren(_currentGamePosition);
                uxTextBox.Text = "Your Turn.";
            }
            else
            {
                _SymbolPlayer    = "O";
                _SymbolOComputer = "X";
                ComputerPlay();
            }
        }