Example #1
0
        public void DrawTest1()
        {
            const int size = 3;

            char[,] board = new char[size, size]
            {
                { 'X', 'O', 'X' },
                { 'X', 'X', 'O' },
                { 'O', 'X', 'O' }
            };

            IPlayer player1 = new RandomIA("AI_1", 'X', size);
            IPlayer player2 = new RandomIA("AI_2", 'O', size);
            Engine  engine  = new Engine(player1, player2, board);

            Assert.AreEqual(true, engine.IsGameOver());
            Assert.AreEqual(null, engine.Winner);
        }
Example #2
0
        public void VerticalWinTest()
        {
            const int size = 3;

            char[,] board = new char[size, size]
            {
                { 'X', 'X', 'O' },
                { 'X', ' ', 'O' },
                { 'O', ' ', 'O' }
            };

            IPlayer player1  = new RandomIA("AI_1", 'X', size);
            IPlayer player2  = new RandomIA("AI_2", 'O', size);
            IPlayer expected = player2;
            Engine  engine   = new Engine(player1, player2, board);

            Assert.AreEqual(true, engine.IsGameOver());
            Assert.AreEqual(player2, engine.Winner);
        }