Exemplo n.º 1
0
        private void PlayAiMiddleMode()
        {
            if (this.matrixAlgorithm.CurrentTurn != PlayerType.X)
            {
                return;
            }

            PointIndex aiHardPoint = this.aiMove.GetAiHardPointIndex(this.matrixAlgorithm);

            foreach (Button button in this.gamePanel.ButtonList)
            {
                if (aiHardPoint.Equals(button.Tag))
                {
                    this.matrixAlgorithm.Board[aiHardPoint.X, aiHardPoint.Y] = this.matrixAlgorithm.CurrentTurn;
                    button.Text = this.matrixAlgorithm.CurrentTurn.ToString();
                    this.matrixAlgorithm.CheckWinner(aiHardPoint, this.matrixAlgorithm.CurrentTurn);

                    if (this.matrixAlgorithm.WinnerState)
                    {
                        this.RestartGame();
                    }
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public void Equals_ParameterIsNotTypeOfPointIndex_ResultIsFalse()
        {
            PointIndex actual = new PointIndex();
            String     s      = "foo";
            Boolean    test   = actual.Equals(s);

            Assert.That(test, Is.False);
        }
Exemplo n.º 3
0
        public void Equals_OtherXIsNotFiveOrOtherYIsNotThree_ResultIsFalse(Int32 x, Int32 y)
        {
            // arrange
            PointIndex testee = new PointIndex(5, 3);
            PointIndex other  = new PointIndex(x, y);

            // act
            Boolean actual = testee.Equals(other);

            //assert
            Assert.That(actual, Is.False);
        }
Exemplo n.º 4
0
        public void Equals_BothXAndYAreEqually_ResultIsTrue()
        {
            // 1) Parameter ist kein Typ PointIndex!
            //    => Ist ein PointIndex ein BitConverter??? => Nein
            // 2) Parameter ist vom Type PointIndex!
            // 2a) beide sind gleich wenn x und y gleich sind
            // 2b) beide sind ungleich wenn entweder x oder y ungleich ist.

            // Bsp 2a.
            // arrange
            PointIndex other  = new PointIndex(5, 3);
            PointIndex testee = new PointIndex(5, 3);

            // act
            Boolean actual = testee.Equals(other);

            //assert
            Assert.That(actual, Is.True);
        }