예제 #1
0
        public void CanTestMiniMaxEarlyGameAsX()
        {
            // arrange
            BoardTests BST = new BoardTests();
            // act
            int result = engine.MiniMax(board, 0, 'X');

            // assert
            Assert.Equal(0, result);
        }
예제 #2
0
        public void CanTestMiniMaxEarlyGameAs0()
        {
            // arrange
            BoardTests BST = new BoardTests();

            board.Cells[8].Symbol = 'X';
            // act
            int result = engine.MiniMax(board, 1, '0');

            // assert
            Assert.Equal(-1, result);
        }
예제 #3
0
        public void CanWinLeftCol()
        {
            // arrange
            BoardTests BST = new BoardTests();

            board.Cells[0].Symbol = 'X';
            board.Cells[3].Symbol = 'X';
            // act
            Tuple <bool, int> result = engine.Utility(board, 6, 'X');

            // assert
            Assert.Equal(-1, result.Item2);
        }
예제 #4
0
        public void CanWinBottomRow()
        {
            // arrange
            BoardTests BST = new BoardTests();

            board.Cells[6].Symbol = 'X';
            board.Cells[7].Symbol = 'X';
            // act
            Tuple <bool, int> result = engine.Utility(board, 8, 'X');

            // assert
            Assert.Equal(-1, result.Item2);
        }
예제 #5
0
        public void CanLoseAntiDiag()
        {
            // arrange
            BoardTests BST = new BoardTests();

            board.Cells[2].Symbol = '0';
            board.Cells[4].Symbol = '0';
            board.Cells[6].Symbol = '0';
            // act
            Tuple <bool, int> result = engine.Utility(board, 7, 'X');

            // assert
            Assert.Equal(1, result.Item2);
        }
예제 #6
0
        public void CanLoseRightCol()
        {
            // arrange
            BoardTests BST = new BoardTests();

            board.Cells[2].Symbol = '0';
            board.Cells[5].Symbol = '0';
            board.Cells[8].Symbol = '0';
            // act
            Tuple <bool, int> result = engine.Utility(board, 0, 'X');

            // assert
            Assert.Equal(1, result.Item2);
        }
예제 #7
0
        public void CanLoseMiddleCol()
        {
            // arrange
            BoardTests BST = new BoardTests();

            board.Cells[1].Symbol = '0';
            board.Cells[4].Symbol = '0';
            board.Cells[7].Symbol = '0';
            // act
            Tuple <bool, int> result = engine.Utility(board, 8, 'X');

            // assert
            Assert.Equal(1, result.Item2);
        }
예제 #8
0
        public void CanTestMiniMaxMidGameAsX()
        {
            // arrange
            BoardTests BST = new BoardTests();

            board.Cells[0].Symbol = 'X';
            board.Cells[4].Symbol = '0';
            board.Cells[3].Symbol = 'X';
            board.Cells[6].Symbol = '0';
            // act
            int result = engine.MiniMax(board, 8, 'X');

            // assert
            Assert.Equal(1, result);
        }
예제 #9
0
        public void CanTestMiniMaxLateGameLossAs0()
        {
            // arrange
            BoardTests BST = new BoardTests();

            board.Cells[0].Symbol = 'X';
            board.Cells[1].Symbol = '0';
            board.Cells[2].Symbol = 'X';
            board.Cells[3].Symbol = '0';
            board.Cells[4].Symbol = 'X';
            board.Cells[5].Symbol = '0';
            board.Cells[6].Symbol = 'X';
            // act
            int result = engine.MiniMax(board, 8, '0');

            // assert
            Assert.Equal(-1, result);
        }
예제 #10
0
        public void CanTieGame()
        {
            // arrange
            BoardTests BST = new BoardTests();

            board.Cells[0].Symbol = 'X';
            board.Cells[1].Symbol = '0';
            board.Cells[2].Symbol = 'X';
            board.Cells[3].Symbol = '0';
            board.Cells[4].Symbol = '0';
            board.Cells[5].Symbol = 'X';
            board.Cells[6].Symbol = 'X';
            board.Cells[7].Symbol = 'X';
            // act
            Tuple <bool, int> result = engine.Utility(board, 8, '0');

            // assert
            Assert.Equal(0, result.Item2);
        }