Example #1
0
        /// <summary>
        /// Each button click event
        /// </summary>
        /// <param name="o">the button click</param>
        /// <param name="e">the button click event</param>
        public void ButtonClick(object o, EventArgs e)
        {
            Button b = (Button)o;

            b.Text = _SymbolPlayer;
            (int, int, int, int)loc = ((int, int, int, int))b.Tag;
            _currentGamePosition.Play(loc);
            if (GameIsover("You") != true)
            {
                _portionOfGameTree = _portionOfGameTree.GetChild(loc);
                ComputerPlay();
            }
        }
Example #2
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));
        }