Ejemplo n.º 1
0
        public void AIEasy_Test_BlockDiagnol()
        {
            // arrange
            GamePlay game = new GamePlay();

            game.Gameboard = new List <int> {
                1, 0, 0, 0, 1, 0, 0, 0, 0
            };
            List <int> result = new List <int> {
                1, 0, 0, 0, 1, 0, 0, 0, 1
            };

            // act
            game.AIMove(GamePlay.Playertype.Easy);

            CollectionAssert.AreEqual(result, game.Gameboard, "Made incorrect move");
        }
Ejemplo n.º 2
0
        public void AIHard_Test_OpenMoveP1()
        {
            // arrange
            GamePlay game = new GamePlay();

            game.Gameboard = new List <int> {
                0, 0, 0, 0, 0, 0, 0, 0, 0
            };
            List <int> result = new List <int> {
                1, 0, 0, 0, 0, 0, 0, 0, 0
            };

            // act
            game.AIMove(GamePlay.Playertype.Hard);

            CollectionAssert.AreEqual(result, game.Gameboard, "Made incorrect move");
        }
Ejemplo n.º 3
0
        public void AIeasy_Test_choosewinningoverblocking()
        {
            // arrange
            GamePlay game = new GamePlay();

            game.CurrentPlayer = GamePlay.Player.Player2;
            game.Gameboard     = new List <int> {
                1, 1, 0, -1, -1, 0, 0, 0, 0
            };
            List <int> result = new List <int> {
                1, 1, 0, -1, -1, -1, 0, 0, 0
            };

            // act
            game.AIMove(GamePlay.Playertype.Easy);

            CollectionAssert.AreEqual(result, game.Gameboard, "choose to block over wining");
        }
Ejemplo n.º 4
0
        public void AIeasy_Test_OpenMove()
        {
            // arrange
            GamePlay game = new GamePlay();

            game.CurrentPlayer = GamePlay.Player.Player2;
            game.Gameboard     = new List <int> {
                0, 0, 0, 0, 0, 0, 0, 0, 0
            };
            List <int> result = new List <int> {
                0, 0, 0, 0, 0, 0, 0, 0, 0
            };

            // act
            game.AIMove(GamePlay.Playertype.Easy);

            CollectionAssert.AreNotEqual(result, game.Gameboard, "did not make move");
        }
Ejemplo n.º 5
0
        public void AIMoveTest_Random()
        {
            // arrange
            GamePlay Game = new GamePlay();

            Game.GameboardRows    = 3;
            Game.GameboardColumns = 3;
            Game.Gameboard        = new List <int> {
                1, 1, 1, 1, 1, 1, 1, 1, 0
            };
            List <int> ExpectedOutput = new List <int> {
                1, 1, 1, 1, 1, 1, 1, 1, 1
            };

            // act
            Game.AIMove(GamePlay.Playertype.Random);

            // accert
            CollectionAssert.AreEqual(ExpectedOutput, Game.Gameboard, "Over wrote existing move");
        }